Barchart is empty when there is no value - html

I am using html5 stacked bar charts in JasperSoft Studio.
When there is no value to be displayed, the chart is totally empty and the 0 (zero) line in the y axis goes to the upper. It doesnt really stay at the level of origin.
How can I get the bars of the chart even if there is no corresponding data to be displayed. like a thin line on the level of zero?
And how can I take the 0 line back on the x axis?

You can set "Range Axis Min Value Expression" to 0 in the stacked bar-chart properties section.
To add open property panel click on the chart and select Windows --> Properties then add
Range Axis Min Value Expression = 0

I faced a similar problem where the bar was not showing up correctly. So what I did was I set the max and the min value in the customizer class
In my case the range of the bar was from 0 to 1.
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setLowerMargin(0.0);
rangeAxis.setUpperMargin(1.0);
rangeAxis.setRange(0, 1.0);

setting maxto a value is a solution but it has a side-effect for me. It fixes the scale of the axis so if the max value is very big compared to the current data we have, the resulting graph doesnt look nice.
I set minRange to 0.1 and it solved my problem. I didnt need to set max after that.

Related

SSRS - Major/minor gridlines spacing

I have an SSRS report with a bar chart with multiple series by CountryName Category group. What I want to do is have gridlines which split each country like below:
However in SSRS the major gridlines seem to interval with the line in the middle of the country name when the grid interval is set to 1 like below:
Can someone point me in the right direction into how to rectify this?
Also is there a way of adding the X axis in SSRS to start from zero like I have in my first graph?
Thanks
You can do it, there is an offset property on the grid lines (horizontal and vertical are separate). Click one one of the gridlines and look in the properties pane. Change the offset to 0.5.
Gives you this.
I'm not sure what you meant about starting from zero on the X-Axis, you have negative values so you'll start from a negative number. If you meant you wantde zero aligned to the middle. You can do that to. You need to set the min and max values of the horizontal axis to the following
Min Value:
=MAX(ABS(Fields!MyValueField.Value), "MyDataSet")*-1
Max Value will be:
=MAX(ABS(Fields!MyValueField.Value), "MyDataSet")
Basically we take the ABSolute largest value and use that as the extent (*-1 for the min value). The problem is that zero might not show so you'll have to play around with the Axis properties maybe to get that working. I'm sure it's possible but I don't have time to test at the moment.
My test data is not great as the number are large

Set static height for bar chart using SSRS

I have a bar chart and the business has requested that I set the height for each bar at a static height i.e. 40 for the entire result set and then have the data labels displayed above the bar.
How can I set the output to a static height for each bar for the entire chart?
It looks like setting the maximum on the Axis plays silly games with the data labels so - as with most things SSRS - lets get creative!
Create your chart as normal.
Open up your Series Properties and change your Series Data Value Field to =iif(<Your column value expression here> > 40, 40, <Your column value expression here>). This will max out your columns at 40.
Open up your Series Label Properties and change the Label Data to =<Your column value expression here>. This will show the true value in your Data Label.
******************************** Alternatively *******************************
you could just enable Scale Breaks on your vertical axis and see if the business likes the look of that as, I would imagine from experience, what they actually want is more visibility on the difference between the smaller columns that are dwarfed by your Oct 10 column and not a pointless column chart where comparison is impossible without manually reading a load of figures.

StripLines with same properties displaying different width

I have two different horizontal stripLines in my bar graph. I am displaying a label for these stripLines through the use of a line chart data type with the corresponding values. My problem is I have the same properties (other than actual value) for these stripLines, but they are displaying at 2 different widths. Does the stripInterval have anything to do with this?
The interval and interval offset for the top line (1200/yr) is;
=Fields!BasicNeed.Value + Fields!LifeStyleNeed.Value
=Fields!BasicNeed.Value + Fields!LifeStyleNeed.Value + 1 (not sure what offset should really be but this displays great)
and for the bottom line which is appearing too thin;
=Fields!BasicNeed.Value
=Fields!BasicNeed.Value + 1
The BorderWidth, BorderStyle, BorderColor, StripWidth, IntervalTypes and everything else are all the exact same except for the actual values above.
I just had this same issue.
The problem for me was that I was using the StripWidth property to control the width of the strip (what was I thinking?). That should be set to 0 - it's actually a proportion based on the total axis value.
Use the BorderWidth property to control the width of the Strip Line.
Also, make sure you set the BorderStyle to Solid. Default looks like Solid but is actually None.
Source: Mark from Dundas
I would set the Interval property back to Auto. You only need to set the IntervalOffset property.

Cannot see all the labels on the x asis in an ssrs column chart

I have a column graph as shown below. It shows only a few x axis labels. I want it to show all the x axis labels. Is there a way this can be done ? I tried changing the size of the chart and this doesnt work
Duplicate question:
SSRS chart does not show all labels on Horizontal access
Best answer was:
To fix this, under the "Chart Axis" properties set the Interval value to "=1". Then all the labels will be shown

SSRS chart does not show y-axis data labels when values are very small (<1)

I have chart that plots values of Y-axis less than 1 (0.1, 0.24, etc).
When the chart is built, Y-axis label just shows 0 at the origin and no other values along the axis.
My solution was a little ugly. Data series labels show up with the correct % signs, but the % signs do not show up on the Y axis.
Y axis: set Y axis range from 1-100 (or 1-120 so there is room to display the data labels that say 100%) Make sure you set your tick marks to Auto or a number between 1 and 100, otherwise you'll get one long bar of tick marks running all the way up the y axis.
Data series: on the series tab, change your Value Field formula to multiply your data series by 100.
Data series labels: on the series data label properties window > general tab, copy the formula from your data series Value Field into the Label Data value field. round it to 0 decimal points and add &"%" to the end to concatenate a percent to the end of it.
That way the right numbers display for my data series and my Y axis, but the % just doesn't show up on the Y axis. not perfect yet. and too much work.
I just tested this and it seems this happens in SSRS 2005 and not 2008. You can fix this by right clicking on your chart and going to properties. It should bring up the full Chart Properties, go to the Y Axis tab and set Major Gridlines at a value like .25/.5 or whatever you want.