Displaying Data Labels on Line chart
Hi All,
I have a simple line chart with date on the x axis and a metric on the Y axis. The grain of the dataset is one day.
The parameters for the report is date range.
Now I have enabled the chart to show data labels, which is a requirement.
The problem is when the users are running the report for a year. then the data labels get cluttered.
Since my report can be run for a couple of days or for the a year ( The dataset could be really small or very big, with many data points). I was wondering if there is a way to display data labels 10 data labels whatever be the case.
Any help is appreciated.
Thanks,
Divam
April 7th, 2011 5:59pm
Hi Divam,
According to your description, you would like to display 10 data labels in any case, right?
If I misunderstand, please let me know.
Is there any rule to follow to get the 10 data labels? If you want to display the 10 date labels
randomly, I suggest you to use T-SQL to get the 10 data labels in dataset, and then display the 10 data labels in the line chart, for example:
SELECT
TOP 10 *
FROM Table ORDER
BY NEWID()
If you have any question, please feel free to ask.
Thanks you,
Eileen
Free Windows Admin Tool Kit Click here and download it now
April 11th, 2011 10:23pm
Please try the below. It is assumed that you have a table called Sales having field SalesDate used for the x series and there are two report parameters
named FromDate and ToDate to filter the dates. Please modify the table, field and parameter names in the below example as appropriate.
1. Add a new dataset (in addition to the dataset you have for the chart query) named datDateGroupsCount and set its query as
="select
COUNT(*) as DateCount
from (
select SalesDate
from Sales where fromdate>='" & Parameters!FromDate.Value & "' and todate<='" & Parameters!ToDate.Value & "'" &
group
by SalesDate) a"
2. Add a parameter named paramDateGroupsCount; Under default values set datDateGroupsCount as dataset; Set DateCount as the value field
Above two steps are performed to get the date group count to the parameter. There may be perhaps better ways than this but this works as well.
3. Now on the chart click on the data label.
In properties window, click the + sign left to the label propertyand drill down
Set the UseValueAsLablel property to false
Set the label property expression to
=iif(RowNumber(Nothing) mod (Val(Parameters!paramDateGroupCount.Value) \10)=0,Sum(Fields!Amount.Value),"")
Note :
Replace Fields!Amount.Value with the field used in the data fields of the chart.
As it is an integer division by 10, it would not always guarantee 10 data labels specially when you have fewer rows, but this should obviously help remove the cluttered
screen due to excessive labels.
Hope this helps
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
BH
April 12th, 2011 5:10am