Can striplines be added to a legend? - reporting-services

When adding stiplines to an SSRS chart, they do not appear as part of the legend. Is it possible to add definitions to the legend for the stiplines?

I resolved this by adding an image for a legend.

Yet another approach.
If strip line is not too complicated and could be described in dataset as series, then move it there and get your legend. Target lines limits, thresholds - all could present in chart as series, just put constant values in corresponding fields.

Related

SSRS single bar-chart

Good day all,
Please am trying to create a SSRS report that looks like the image below
i have my table structure in this manner
Please note the data are not in relation with the chart
But all i could get as a result is a multiple bar chart. that resembles the image below.
Thanks in anticipations of your response
First of all, your "Balance on COC" is negative. That's probably not just a chart visualization issue.
You can format the numbers on the y-axis to be more readable like they are in your first screenshot. Click on the Chart Axis and set the LabelsFormat property to #,0;(#,0).
While numbers in the chart can have up to 16 digits, that is highly unreadable for most people. You might want to consider visualizing the numbers in Billions instead.
To get the labels on the x-axis you'll need to set that field as the Category Group. Then you can delete the legend area from the chart. You can also remove the "Axis Title" areas since they are not needed in this case. This will all make it look more polished like the other image.

Different color chart

I have 2 kinds of charts,pie chart and column chart.
I present the same data of both charts, the problem is that color that presents each equipment is not the same in both of them.
Thanks
The chart legend uses color fields to match the legend items to the
visible data points. The legend can only show one color field per
legend item (data series); hence, it shows the color of the first data
point within that series. Remember this when you use expressions to
dynamically determine the color of individual data points within a
series; the legend item always shows the actual color of the first
data point.
Using the same legend order in both charts should do the trick.
Series are ordered in the legend according to the order that they are
processed by the Reporting Services processing engine. You can change
the order by changing the order of fields in the data fields
drop-zone. If you are using series grouping, the series data is not
known until processing, so that there is no way for you to re-order
these items.
If you're using series, which you probably are, you should make sure they're ordered correctly before sending them to the reporter.
Another solution is to create a custom legend for your charts. Which gives you a lot more control, especially if you define a custom color palette aswell.
You can get more flexibility and control over the legend by generating
your own custom legend by using a table or a matrix. The easiest way
to synchronize the colors in the chart with your custom legend is to
define your own custom chart color palette.
To build a custom legend
Add a table data region to the report.
Place the table next to the chart and bind it to the same dataset as the chart.
Mirror the chart grouping structure in the table by adding table
groups.
If the chart uses series groupings, add them to the table by
adding table groups that are based on the same group expression as
the one in the chart series groupings. Then add chart category
groupings (if present) as inner table groups.
In general, if the
chart has m series grouping and n category grouping, you add m+n
table groups for your custom legend.
For the individual table
groups, make sure to show only the group header (which will contain
the legend description). Also, remove the table detail row unless
you want to use the table detail rows to simulate a chart data
table.
Design the custom legend.
Add a rectangle for the color field of the
custom legend. For example, you might add it to the first table
column. As indicated in step 2, you should only have group header
rows in the table. The rectangle goes into the innermost group
header level.
Set the rectangle BackgroundColor property to the equivalent expression used on the chart data point's fill color. In the most
trivial case, the expression would just contain one grouping value as
in the following code.
=Code.GetColor(Fields!Country.Value)
For the legend text, use either the same expression as in the category and series group/label expressions, or experiment until you
achieve the legend description text that you want.
Sources:
Get More Out of SQL Server Reporting Services Charts
Formatting the Legend on a Chart

Hide Duplicate Legend Items in SSRS Report Chart

I have a stacked column chart in SSRS that displays data by hour. Included in this data is the meters reading, kVa, Average Temperature and Heat Index for that hour. For some reason, the legend items for the temperature values and the kVa are being repeated for each meter in the dataset. I would like for my legend to have the following values: kVa, Average, Heat Index and each meter number. I included a sample of the chart, the chart data configuration as well as some sample data below. Any idea how I can accomplish this? Please let me know if any other information is required.
Here is a good solution which covers all possible scenarios
go to "Report Properties" (right click in the blank area)
go to variables and add a new variable called myflag, set the value to "true" and deselect Read-Only
go to the "Series Properties" and then to "Legend" and click the expression button next to "Do not show this series in legend"
Type or paste this code:
=IIF( Variables!myflag.Value = true, false, true )
=Variables!myflag.SetValue( false )
and that's it.
hint
You can use the same variable in the same series' visibility expression without the setting part in the second line to avoid overlapping the drawing of the same series on the chart
I couldn't get either of these answers to work for me. Ended up using RowNumber and CountRows in the expression for Do not show this series in a legend property.
=IIF(RowNumber("Dataset")=CountRows(),false,true)
You're getting one set of legend values per series you've added. For each series besides the one whose legend you want to keep visible, right click the series (each top-level row in the "Values" box), choose Series Properties, go to the Legend tab, and check "Do not show this series in a Legend."
I was able to fix my issue using information from this question on stack overflow: https://stackoverflow.com/a/1867343/965213
Go to the Legend page of the series properties you want to include in the chart.
Edit the function for the "Do not show this series in a legend" property.
Use this formula: =IIF(Fields!SerialNumber.Value=Last(Fields!SerialNumber.Value,"MeterDetail"),false,true)
Now the series will only be repeated once instead of once per series group.
Hope this helps!

Is it possible to add items to legend that are not on the chart?

I have a column chart in SSRS with a single series group. The chart is perfect but I need to add a couple of items to the legend even though they are not part of the chart (don't ask). If I add them to the data source with 0 values, the width of my columns still change to reflect the new number of items in my series group.
I ended up using Word to create an image of the proper legend and using this image as my legend. Works great but feels like duct tape.

In SSRS how to conditionally change the colour of a datalabel font on a chart when it appears on the bar

I have created a bar chart that shows values on data labels.
The Data label is placed outside the bar
But in some cases the label appears on the bar where the bar is too long.
In this scenario I would like to conditionally change the font/colour of the data label so that it's more visible.
However I can't see a way to dynamically determine where the label has been placed.
What I can think of is this. You can change the background/font color of all those series labels who's value lies in the range of 95%-100% of the maximum "Value". To be exactly precise as to what should be the threshold to change the bg/font color seems a daunting task, but you could play around with test data.
For writing the expression to change the font color,I would first change the dataset and add a column on the lines of PercOfMax. This column can be calculated easily in the dataset by using basic aggregate functions.
Then you need to go to the Chart Series Label properties-->Color and write the expression on the lines of -
=IIF(Fields!PercOfMax.Value>=95, "YELLOW", "BLACK")
As I said, you might need to do some more research to finalize the value of this threshold(which I am assuming to be 95).
Another solution to this problem is to use fill colour of the label and set its background to a bright colour (e.g. colour), and leave the font colour of the label black. Thus you can always see the label, and there is no difference when it's outside of the bar.