linear Dataseries Say 0 on Y Axis Having Issue - highcharts

Linear Dataseries Say all y axis is 0, Autoscaling on y axis is not working as desired.
High stock version - 1.3.1
DataSeries to be plotted,
[[1149724800000,0],[1149811200000,0],[1150070400000,0],[1150156800000,0],[1150243200000,0],[1150329600000,0],[1150416000000,0],[1150675200000,0],[1150761600000,0],[1150848000000,0],[1150934400000,0],[1151020800000,0],[1151280000000,0],[1151366400000,0],[1151452800000,0],[1151539200000,0],[1151625600000,0]]
OR
[[1149724800000,20],[1149811200000,20],[1150070400000,20],[1150156800000,20],[1150243200000,20],[1150329600000,20],[1150416000000,20],[1150675200000,20],[1150761600000,20],[1150848000000,20],[1150934400000,20],[1151020800000,20],[1151280000000,20],[1151366400000,20],[1151452800000,20],[1151539200000,20],[1151625600000,20]]
Try Above series with Y min set to 0 and Y Min to Auto.

I had the same issue with 0 values displayed in the center.
The only way I found to get round it was to either use tickPositions and pass range values across to it for the data based of min/max values and ones in between or to use the tickPositioner call back function to return to go through the data and return the tick values based on these.
Still fairly new to highcharts so there is probably another way I don't know of. If anyone knows how to have 0 values displayed at the bottom of the chart while it auto-scales then please post as I would love to know how/if its possible.
Edit: turns out this isn't really possible currently, only way to get around it is to set min/max values and that won't allow auto scaling but at least it stop there from being any middle 0 values.

Related

Coreplot Y axis cut off / no numbers?

I am having issues with my implementation of CorePlot. I have a subview in my UIViewController than contains the chart. Most of the data shows up fine but no increments / values are showing up on the y axis.
This is what I am seeing now:
If I shift the x axis start point by subtracting 10 (to better see the left half of the chart) I see this:
For the record, I do not have any values outside of the (positive x, positive y) quadrant on the chart and have logged out my data to verify this. Any input / advice would be appreciated, thank you!
http://www.raywenderlich.com/13271/how-to-draw-graphs-with-core-plot-part-2
This guy does a great job explaining that about halfway down... search for "You're Getting There!" to find exactly where he talks about the weird lines in the Y axis.
Hope this helps!
Set the leftPadding on the graph.plotAreaFrame to leave room for the axis labels at the left side of the graph.
The smeared y-axis is caused by too many tick marks and labels—they overlap and become illegible and negatively impact drawing performance. You need to adjust the labeling parameters to reduce the number of ticks and labels. By default, the axis draws major tick marks and labels one unit apart. The properties that need to be changed depend on the labeling policy you want to use.

Proportional pinch zoom limit in core plot iOS?

The question is similar to this one
But in my case I have a proportional zoom. For example, if I use x2 zoom on x axis then y axis has the same x2 zoom. In this case all the graph lines store their angles.
The problem is in the following method:
-plotSpace:willChangePlotRangeTo:forCoordinate:
It takes a specific param - xAxis or yAxis (not both) and in my case xAxis has limitations only. So while xAxis zoom is constant (because it has reached its limit) yAxis zoom still may be increased or decreased. It is hard for me to calculate yAxis limitations because xAxis and yAxis mean time and price (have different measurements).
How to solve this issue?
I tried to use plotSpace:willChangePlotRangeTo:forCoordinate: but it is useless for my case. If it returns NO then the label places are persistent.
The second reason I shouldn't use this method is method plotSpace:willChangePlotRangeTo:forCoordinate:. This method is for replacing old labels with new ones but it is called even less often. So I moved all the calculations into it.
Proportional zoom is by default (if there is no code preventing zoom).
And finally I wrote a BOOL variable which equals YES when the limit on X axis is reached and prevents changing of Y axis values in this state.

How to set min and max values for an axis?

I have some data that can have values in the range (0..100). Highcharts will sometimes label the axis from -10 to 110, which looks odd.
How can I prevent this? I can set a fixed min and max value for the axis, but if the current values happen to be between e.g. (50..60), I'd rather let Highcharts zoom in on the axis accordingly. Just don't want Highcharts to ever show anything outside of (0..100).
I could of course determine the appropriate min and max values myself every time I load data, but was hoping there would be some kind of minMin and maxMax setting?
So it looks like this isn't possible; opened a feature request.
Nowadays highcharts has floor and ceiling options for this use case.

How to prevent Highchart from severely change declines?

The problem is that, if I try to change the lowest point to somewhere higher, the entire chart will be lowered severely.
How do I adjust each point with no above mentioned issue?
P.S. I use Highchart's Highstock.
It would be helpful if you could show a JsFiddle with the actual working code. Without knowing what exactly is going on with your chart it's difficult to figure out what the issue is and how to fix it.
Have a look at the yAxis - Highstock API Reference, you could potentially make use of min or max to counteract the scaling. Again though, without seeing your code it's tough to know.
If I understand your problem, you are trying to set the 7th point from currently at ~150 to something really high, say 5000? I did not notice any real change in the position of other points if the new value was under 1500 (or something around twice the first point)
Appears that your chart is set to comparison mode, hence, I believe, the default max and min are (100% & -100%) by default, this is w.r.t. to first point of the series. Highcharts would auto adjust these extremes if any of the points were to lie outside this range, you could force an override using yAxis.min & max.
For instance, you can set yAxis.min to -100 and yAxis.max to 100 like this
yAxis: {
min:-100,
max:100
}
Play around with the min and max to get to the values that suits your data the most, do remember these are % comparison to the first point. Any points outside these ranges would not show in the chart.
#jsFiddle

TChart - Dont plot values that are less than 0?

Introduction
I am using the TChart component and am finding the options rather confusing and hard to find what I need.
The Left Axis of the chart has a minimum of 0 and a maximum of 5000, the Bottom Axis has a minimum of 0 and a maximum of 52 (weeks in a year).
In my chart I have 2 series that are populated based on values from a record I have created which can be edited at runtime, everything is working good so far.
Problem
Take a look at the below image of part of the chart filled with some random values:
I am not sure if such an option exists or not, but notice from week 4 onwards where no values have been added there is a solid red line.
I don't want the chart to plot values that are less than 0, so in this example from week 4 onwards there should be no more lines (I can confirm that from week 4 onwards I have the values set at -1)
Week 1 to 4 does not show this bottom red line, obviously because the values are greater than 0 and are therefore plotted above the line, but this should make my problem a bit more clearer.
So, how do I prevent the chart from plotting / drawing values that are less than 0, importantly for the Bottom Axis of the chart?
I am sure there must be a simple option somewhere, I just cannot find it if there is one as I am not too familiar with the TChart Component.
You have the possibility when adding values to a series to add them as null.
This will prevent them from showing.
Ken is correct saying that a tricky situation is to handle a single value surrounded by null values.
Picking another series type than FastLine and show dots as well as lines might work better.
For a FastLine series to show gaps, set:
Series1.IgnoreNulls := False;
And to discriminate values below zero:
if (y < 0) then
Series1.AddNullXY(x, y, '')
else
Series1.AddXY(x, y, '');
if y < 0 then
LineSeries1.AddXY(x, y, '', clNone)
else
LineSeries1.AddXY(x, y, '', clRed);

Resources