Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : Mix Scatter and Line in Reporting Services Charts


GH
6/6/2005 4:07:15 PM
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
Robert Bruckner [MSFT]
6/6/2005 9:23:06 PM
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.




[quoted text, click to view]


=============================================================

<?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 &gt;= 100,
iif(Fields!SeriesId.Value &gt;= 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>
jxu
6/19/2006 11:39:01 AM
Did you mean you can mix Bar and line in a chart? If yes, how did you do it?
Thanks in advance.

[quoted text, click to view]
Tim Dot NoSpam
6/20/2006 9:46:37 AM
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".

[quoted text, click to view]

NP
5/23/2007 8:08:02 AM
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?

[quoted text, click to view]
AddThis Social Bookmark Button