SSRS line chart. How to stop numbers from repeating in vertical axis - sql-server

I have a line chart in ssrs. Whenever the highest line values are 1 or 2 instead of getting a scale of 0,1,2 which is what I want, I get 0,1,1,2,2. This dosn't make sense especially because the number values are not decimals and are unformatted.
Please help.

The Expression for the vertical axis Interval should be below expressions.
If your value is sum
=IIF(Max(Sum(Fields!Item.Value))<20,1,"Auto")
If your value is count
=IIF(Max(Count(Fields!Item.Value))<20,1,"Auto")
Note: I used 20 as the above that the Auto will work good. Make according to your requirement.

Sounds like there is formatting on the vertical axis: That it's actually trying to show 0, .5, 1.0, 1.5, & 2 but after rounding that comes out as 0,1,1,2,2
You should change the vertical axis interval from "Auto" to 1:

I understand that this is quite old post. Still I wanted to reply..
I faced the same issue on column chart when the scale was of small range....
So I used the following expression in axis properties->interval
=IIF(Max(Fields!count_Items.Value)>=6,0,1) - [note: here 0 means - Auto interval]
Hope this answer helps someone. :)

The problem here is not only the interval but also the maximum value of the range that the axis uses. You can set the value for the Interval with this type of expression IIF(Max(Sum(Fields!Item.Value))<20,1,"Auto") but the axis can still make the scale too large. It then tends to fill in with decimals or if you suppress decimals you get repeating integers.
Use a custom code like this:
Public Shared Function AxisRange(ByVal Number As Double) As String
Dim RangeString as String
If Number <=5 Then
RangeString ="5"
Else If Number <=10 Then
RangeString = "10"
Else RangeString = "Auto"
End If
Return RangeString
End Function
In the Maximum value of the range use an expression like:
=code.AxisRange(Max(Fields!Field.Value))
By doing this you force the maximum value of the range to be a similar size to the maximum value in your chart. This solves the problem.

Related

LiveCharts - How to prevent the Y-Axis from showing double values?

I have a Columndiagram. This diagram may have Y values from 0 to very larg numbers.
My problem:
When the Y values are small (from my observation smaller than 7), the chart shows double values. (for example: 0, 0.01, 0.02 ... , 0.1), which is in my case not correct.
What I want:
force the Y Axis to use integers.
What I cannot do:
I cannot define a seperator for the Y axis and set its Step to 1. Becuase if I do it, I'll have Step= 1 even if the values are very large, which is not desirable.
Is there any workaround for it?
By default, the library decides the step (when you don't force it) with the CalculateSeparator() method (for more info see this), since the library should also allow you to plot decimal values, it can not be forced to display only integers.
A simple work around I can think of, is to force the Axis.MaxValue property.
In your case, when your values are less than 7, I would force the Axis.MaxValue to 10 (or any other value that works fine for you), then when the data in your chart is greater than 7, you can set Axis.MaxValue back to double.NaN and the library will calculate this limit by it self.
I hope it helps you.

Angular NVD3 y-axis scale

I have an app that creates discrete bar charts. For some odd reason (which seems to be an internal error in the library), the y-axis scales to a data value which has the LOWEST number of integers in the value. For example, one data set has (1750, 1056, 1200, 850). The y-axis scales the maximum range to "850", even though the other numbers are all larger. I've tried using the forceY function, setting the maximum range value to the callback of the data value in my json, but it doesn't work. The problem only corrects itself if all of the numbers in the data set have the same number of integers in the value (i.e. all hundreds, thousands, etc). What is going on and is there a way to fix it??
For reference, here is my plnkr. Go to the "Top 5 SIC by Comments" report chart to see what I mean. The same problem occurs with the "Top 5 Topics by Comments" report chart as well. If anyone has any insight as to how to fix this problem, please let me know. Thank you ahead of time.

Silverlight Visifire Chart Axis Minimum Interval

I have a stacked bar chart with Days values displayed on the X Axis that needs to dynamically change it's size.
When I have a small number of points, let's say 2, the Interval value has a small value and instead of seeing only 2 labels on the axis, there are a lot many.
The ideal value would be Interval = 1 (with IntervalType="Days"). But this causes another problem: when the Interval is set like this, in case there are a lot of points and the size of the chart is small, the labels are all displayed because the Interval does not change.
Here are a few screenshots to illustrate the problem:
http://imgur.com/LEFEZjq,seYdvMJ,eVydRNB,Jwvu5s7
Interval left default and enough points (5/31 - 6/10):
http://imgur.com/LEFEZjq,seYdvMJ,eVydRNB,Jwvu5s7#0
Interval left default and small number of points (5/31 - 6/1):
...#1
Interval = 1 and small number of points (5/31 - 6/1):
...#2
Interval = 1 and large number of points (5/31 - 7/29):
...#3
My question is: Is there a way to have both? To set the Interval to 1 but still get rid of excess labels when the don't fit?
My idea was to have Interval be a maximum of 1 and the default calculated value, and I tried to implement it by changing it at the Rendered event, but this doesn't seem to work.
Nevermind.. I just went with a Numeric DataMapping instead of the DateTime one and mapped the AxisXLabel and ToolTipText to the date.
With dates it seems a little buggy but this way it works fine.

Create GitHub punch card like plots with JFreeChart

I am looking for suggestions as how to create plots similar to GitHub punch cards with JFreeChart. E.g.
I guess it's some variant of a heat map, or two dimensional histogram.
Ok, so I found XYBubbleRenderer which looks like a good starting point.
create a MatrixSeries with rows = 7, columns = 24
fill in the frequencies accordingly. I found it useful to normalise the values first to 0...1, then take the square root (smaller values have a bit better visible circles), then multiply by 0.5 (otherwise the circles are too large)
create a MatrixSeriesCollection from that
use ChartFactory.createBubbleChart
the circle outline can only be removed via plot.getRenderer.setSeriesOutlinePaint(0, new Color(0, 0, 0, 0))
ensure integer tick units on both axis
x-axis range -0.5 to 23.5, y-axis range -0.5 to 6.5 (or 0.5 to 7.5 if you use Calendar.DAY_OF_WEEK)
custom NumberTickUnit for the y-axis to use day labels instead of numbers
The result:
In addition to XYBubbleRenderer, suggested here, also consider a suitable implementation of TableCellRenderer and Icon, illustrated here.

WPF PathGeometry - Bounds are wrong?

I've got a fairly simple PathGeometry:
M567764.539,5956314.087L567815.077,5956179.775L567821.625,5956182.314L567773.425,5956311.248L567858.513,5956349.923L567950.858,5956392.466L567949.039,5956399.843L567942.252,5956396.685L567873.018,5956364.467L567799.816,5956330.421L567771.226,5956317.186L567764.539,5956314.087
Now when I query the PathGeometry.Bounds attribute for this data I get the following bounds:
567764.5625,5956180 567950.875,5956400
The expected bounds would be:
567764.539,5956179.775 567950.858,5956399.843
My main problem: the bounds are smaller than the geometry, so parts of the geometry might be outside the bounds.
I create the PathGeometry and show the bounds like this:
PathGeometry geo = PathGeometry.CreateFromGeometry(Geometry.Parse("M567764.539,5956314.087L567815.077,5956179.775L567821.625,5956182.314L567773.425,5956311.248L567858.513,5956349.923L567950.858,5956392.466L567949.039,5956399.843L567942.252,5956396.685L567873.018,5956364.467L567799.816,5956330.421L567771.226,5956317.186L567764.539,5956314.087"));
System.Diagnostics.Trace.WriteLine(geo.Bounds);
What am I doing wrong?
And, more important, how do I get the right bounds for a PathGeometry?
At some point, I would think WPF has to convert to single point for rendering, and I wonder if the value of Bounds is based off of the rendered result. In this case, you're probably seeing a precision limitation based off of the large numbers you're using. I noticed that your Y values were a factor of 10 larger than X, and coincidentally the error was also a factor of 10 larger than the error in X.
If it's possible to subtract off the min X and Y before creating the PathGeometry, I think you'll get better numbers. Assuming you're displaying the PathGeometry, you could place it in a Canvas and apply Canvas.Left/Top to your values to get the right offset on screen. To get the correct bounds, you would then add the Top/Left offsets to the result of your Bounds.
Just a reminder that there's a bit of speculation in this answer. I haven't looked at the innerworkings of Bounds, but the relative error seems to point to a conversion to and from floats.
I think you're seeing the imprecision due fact that the numbers PathGeometry is made up of large floating point numbers.
I'm not sure if you'll be able to obtain the precision that you need.
You will probably have to compare the bounds using an acceptable tolerance, like:
bool isMatch = (Math.Abs(MyPath.Bounds.X - ExpectedBounds.X) < TOLERANCE);
where you can set the TOLERANCE to 0.25 or something.

Resources