Monday, March 19, 2012
Mix Scatter and Line in Reporting Services Charts
'expected'. I can mix bar and line but not scatter and line. Also tried to
over-lay two chart (which of course fails when viewed in html.As you have already found out - the approach of overlapping charts does only
work for image-based renderers (e.g. Preview, PDF, TIFF), but not for HTML.
It is possible to achieve what you want with a "scatter line" chart natively
in RS 2000 SP1. However, this is not trivial and the shown approach has the
limitation that you cannot use the default chart legend (you may want to
check my custom legend sample available either in the archives of this
newsgroups or on Brian Welcker's blog:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx).
In addition, you would need to prepare the data in a special way (e.g. with
a stored procedure) so that it contains both, the individual datapoints as
well as the line data. Attached is a sample RDL - it will require some
careful study! It is just a proof of concept that it is possible to do this
in RS 2000 SP1.
The RDL sample is copy&pasted to the bottom of this posting.
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"GH" <GH@.discussions.microsoft.com> wrote in message
news:6E0AA4E3-B6E6-4CBC-91DC-4A1C6028CE70@.microsoft.com...
>I want to display the data points as a scatter chart with a line for
> 'expected'. I can mix bar and line but not scatter and line. Also tried
> to
> over-lay two chart (which of course fails when viewed in html.
=============================================================
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Body>
<ReportItems>
<Chart Name="chart1">
<ThreeDProperties>
<Rotation>30</Rotation>
<Inclination>30</Inclination>
<Shading>Simple</Shading>
<WallThickness>50</WallThickness>
</ThreeDProperties>
<Style>
<BackgroundColor>White</BackgroundColor>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>RightCenter</Position>
</Legend>
<Palette>Default</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Sum(Fields!X.Value)</Value>
</DataValue>
<DataValue>
<Value>=Sum(Fields!Y.Value)</Value>
</DataValue>
</DataValues>
<DataLabel />
<Style>
<BorderWidth>
<Default>3pt</Default>
</BorderWidth>
<BorderColor>
<Default>=iif(Fields!SeriesId.Value >= 100,
iif(Fields!SeriesId.Value >= 200, "DodgerBlue", "GreenYellow"),
Nothing)</Default>
</BorderColor>
<BorderStyle>
<Default>Dotted</Default>
</BorderStyle>
</Style>
<Marker>
<Type>Square</Type>
<Size>6pt</Size>
</Marker>
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title />
<MajorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</CategoryAxis>
<DataSetName>DataSet1</DataSetName>
<PointWidth>0</PointWidth>
<Type>Scatter</Type>
<Top>0.125in</Top>
<Title />
<Width>4.75in</Width>
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="chart1_CategoryGroup1">
<GroupExpressions>
<GroupExpression>=Fields!Id.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!Id.Value</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<Height>3.875in</Height>
<SeriesGroupings>
<SeriesGrouping>
<DynamicSeries>
<Grouping Name="chart1_SeriesGroup1">
<GroupExpressions>
<GroupExpression>=Fields!SeriesId.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!SeriesId.Value</Label>
</DynamicSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>SmoothLine</Subtype>
<PlotArea>
<Style>
<BackgroundColor>LightGrey</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<Left>0.625in</Left>
<ValueAxis>
<Axis>
<Title />
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>4.375in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>43c9f73e-1490-476c-8572-d6b0d099d9a8</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=(local);initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>6.5in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="Id">
<DataField>Id</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="SeriesId">
<DataField>SeriesId</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="X">
<DataField>X</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="Y">
<DataField>Y</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>select 10 as Id, 0 as SeriesId, 1 as X, 1 as Y union
all
select 11 as Id, 0 as SeriesId, 1.6 as X, 1.4 as Y union all
select 12 as Id, 0 as SeriesId, 2.7 as X, 3 as Y union all
select 13 as Id, 0 as SeriesId, 4 as X, 4 as Y union all
select 20 as Id, 1 as SeriesId, 1.5 as X, 2 as Y union all
select 21 as Id, 1 as SeriesId, 4 as X, 3 as Y union all
select 100 as Id, 100 as SeriesId, 1.2 as X, 1.0 as Y union all
select 101 as Id, 101 as SeriesId, 1.7 as X, 1.5 as Y union all
select 102 as Id, 102 as SeriesId, 1.9 as X, 2.2 as Y union all
select 103 as Id, 103 as SeriesId, 2.3 as X, 2.7 as Y union all
select 104 as Id, 104 as SeriesId, 3.0 as X, 3.1 as Y union all
select 105 as Id, 105 as SeriesId, 3.7 as X, 3.8 as Y union all
select 200 as Id, 200 as SeriesId, 1.6 as X, 2.2 as Y union all
select 201 as Id, 201 as SeriesId, 1.9 as X, 2.3 as Y union all
select 202 as Id, 202 as SeriesId, 2.3 as X, 2.4 as Y union all
select 203 as Id, 203 as SeriesId, 2.9 as X, 2.5 as Y union all
select 204 as Id, 204 as SeriesId, 3.3 as X, 2.9 as Y union all
select 205 as Id, 205 as SeriesId, 3.8 as X, 3.0 as Y</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>70f720a6-1b18-43f1-a9d5-2d24de087995</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>|||Did you mean you can mix Bar and line in a chart? If yes, how did you do it?
Thanks in advance.
"GH" wrote:
> I want to display the data points as a scatter chart with a line for
> 'expected'. I can mix bar and line but not scatter and line. Also tried to
> over-lay two chart (which of course fails when viewed in html.|||You can display individual items up to render as lines.
Set the chart up to be a bar chart. Add 2 values. Go to properties for the
2nd value and [I think] go to the 2nd tab. There should be a check box for
"Display or Render as Line".
"jxu" <jxu@.discussions.microsoft.com> wrote in message
news:AE549848-174D-41D0-B20F-90CBFD34BF55@.microsoft.com...
> Did you mean you can mix Bar and line in a chart? If yes, how did you do
> it?
> Thanks in advance.
> "GH" wrote:
>> I want to display the data points as a scatter chart with a line for
>> 'expected'. I can mix bar and line but not scatter and line. Also tried
>> to
>> over-lay two chart (which of course fails when viewed in html.|||I posted a question regarding this scenario and how it effects the legend. I
created the chart you described below but now the legend also got updated
with a second series and I do not want this. The line I plotted does not
require legend entries. How do I get rid of these?
"Tim Dot NoSpam" wrote:
> You can display individual items up to render as lines.
> Set the chart up to be a bar chart. Add 2 values. Go to properties for the
> 2nd value and [I think] go to the 2nd tab. There should be a check box for
> "Display or Render as Line".
> "jxu" <jxu@.discussions.microsoft.com> wrote in message
> news:AE549848-174D-41D0-B20F-90CBFD34BF55@.microsoft.com...
> > Did you mean you can mix Bar and line in a chart? If yes, how did you do
> > it?
> > Thanks in advance.
> >
> > "GH" wrote:
> >
> >> I want to display the data points as a scatter chart with a line for
> >> 'expected'. I can mix bar and line but not scatter and line. Also tried
> >> to
> >> over-lay two chart (which of course fails when viewed in html.
>
>
Mix Relative and strict dates
I am trying to write a report where I can have a drop down with values like
yesterday,today,lastweek.
But I also want the user to be able to select a specific range, say 7/1/2006 to 7/5/2006.
Also why can't i update the value of a parameter through to an expression? Like set the value to =Today(). It throws an error about the type.
Can someone point me in the right direction here?
Parameters are typed so you cannot mix relative dates with specific ones. So, you will need muliple parameters and way to determine which ones to use. I would use three parameters, the first one is a drop down with the realative dates and an entry like "Specify." The other two are DateTime parameters for specifying the start and end dates.The "Specify" entry is to indicate that the user wants to specify specific dates. Otherwise, the user would choose the relative date and the specific dates would be ignored.
For the issue about an error being thrown when you are using the expression, =Today(): make sure the parameter's type is set to DateTime or use =Today().ToString() as the expression, if the parameter's type is string.
Ian|||
I normally use = today, no parentheses, in the parameters
99
|||I cannot assign a parameter of type DateTime, through the web service. SetParameters() to '=Today()'
|||I think the issue is that you are passing the string '=Today()' where a DateTime is expected. Expressions are not evaluated here, so you need to specifiy the actual value, instead of an expression. E.g., DateTime.Today.
Or you can place the "=Today()" expression directly in the Report for the parameter, where it will be evaluated.|||once you deploy the report with an expression for the value of a parameter, can you change that, without re-deploying the report. Is there a call that can be made to change that expression in the report?|||Expressions are compiled at publish-time and cannot be changed without re-publishing the report. This re-publishing can be done programmatically, but I think there are better alternatives.
What are you looking to accomplish with changing the expression?
Ian|||I am trying to get the user be able to select either the relative dates, yesterday, lastweek... OR select a strict date range in a linked report. Also do you know if there is a control which only displays the parameters of the report, which can be used to display them.|||What would be the way to determine which one to use? Can this all be done while designing the report? do you have an example?