Monday, March 12, 2012

How to create a Line Graph with 2 Lines ?

Line Graph :
My requirement is to create a chart that shows 2 employee-career
lines. One is Titles and the other is Salary. This means there should
be 2 lines , one is a line that shows how the titles of the employee
changed. The other is the salary line that will show how the salary
for the employee changed.
I have to show the 2 lines in the same chart. The X-axis will show the
date/time. The query that i wrote will have the fields
userid,
employee,
companytitleid,
companytitle,
rankid,
Salary
Each row will show either a Change in the salary or a change in the
titleid.
Iam using this query as input to the chart.
My problem is what do I mention for the series groups ? The titleid
will have a min of 1 and max of 10. The salary will be a min of 10000
or max of any number.
How do I set up the chart to show the 2 lines ? Is my approach correct
? Typically how would anyone do this chart ?
thanks,
Anand Sagar
FYI
this is my query result
userid, employee, companytitleid,companytitle,rankid,Salary
72 NULL NULL NULL NULL 09/10/2004 6000
72 NULL NULL NULL NULL 09/15/2004 10000
72 NULL NULL NULL NULL 09/20/2004 15000
72 NULL NULL NULL NULL 10/06/2004 5000
72 Rahul Chawla 2 President 1 06/01/2001 NULL
72 Rahul Chawla 3 Vice President 2 01/01/2001 NULLYour query needs a little work. You will probably not want nulls returned. In
your example you have null for the employee and companytitleid in some
records but still a salary figure. The chart control will not like that. I do
not know whether or not you are using a stored proc to retreive the data, but
I would recommend that you do.
As to charting both lines on the same chart it is quite normal and easy to
do. You will need to either multiply the companytitleid by some number like
1000 or divide the salary amount by a number; just to get the lines to look
right on the chart since the values are so different. I normaly change the
legend text to show which line has been adjusted ( Title Level
Salary/1000).
Note that you are only allowed 1 Y-axis scale in the current version. There
are fairly ugly work arounds but you probably don't want to go there.
"Anand Sagar" wrote:
> Line Graph :
> My requirement is to create a chart that shows 2 employee-career
> lines. One is Titles and the other is Salary. This means there should
> be 2 lines , one is a line that shows how the titles of the employee
> changed. The other is the salary line that will show how the salary
> for the employee changed.
> I have to show the 2 lines in the same chart. The X-axis will show the
> date/time. The query that i wrote will have the fields
> userid,
> employee,
> companytitleid,
> companytitle,
> rankid,
> Salary
> Each row will show either a Change in the salary or a change in the
> titleid.
> Iam using this query as input to the chart.
>
> My problem is what do I mention for the series groups ? The titleid
> will have a min of 1 and max of 10. The salary will be a min of 10000
> or max of any number.
> How do I set up the chart to show the 2 lines ? Is my approach correct
> ? Typically how would anyone do this chart ?
> thanks,
> Anand Sagar
>
> FYI
> this is my query result
> userid, employee, companytitleid,companytitle,rankid,Salary
> 72 NULL NULL NULL NULL 09/10/2004 6000
> 72 NULL NULL NULL NULL 09/15/2004 10000
> 72 NULL NULL NULL NULL 09/20/2004 15000
> 72 NULL NULL NULL NULL 10/06/2004 5000
> 72 Rahul Chawla 2 President 1 06/01/2001 NULL
> 72 Rahul Chawla 3 Vice President 2 01/01/2001 NULL
>|||You are absolutely correct.
I removed the nulls, I wrote a sp so that instead of the null, the
value in the previous row is maintained. It worked ! I got the 2 lines
working. But I thought Reporting Services should have something nicer
for the Graph Reports. are we going to see anything better in the
Graph chart in the next release ?
Thanks,
Anand Sagar

No comments:

Post a Comment