Is it possible in high-charts to show your X axis proportional to your data points.
Lets say my x axis data is [1,2,5,8,30,50] and these are say years.
I would like the chart to distance the points proportionally so the chart looks more reasonable to view. In this example while point 1, 2 would be closer but distance between 2 and 5 should be roughly three times distance between 1 and 2 and so on.
Basic idea is when you see how the values are changing between year 8 and 30 than visually it conveys right message to your brain.
Thanks
You can use the tickPositions feature and pass a wanted array of the xAxis values to achieve your requirements.
Demo: https://jsfiddle.net/BlackLabel/vm1eh4su/
API: https://api.highcharts.com/highcharts/xAxis.tickPositions
Related
I cannot find how to do this for a while now, my graph is drawn ok every time but I want to move up my graph, like when you have f(x) + n. So, what I want to do actually is change Y origin, so I can draw my (x,0) points. I do not want to draw my points on X axis, I do not see the line that good. I want that my zero Y point actually starts at point three, but not to transform the graph at the same time. Here is picture of what I want to do (see the green line and Y point):
The plot space yRange controls the range of data visible. The image in the question looks like it has a location of negative one (-1) and length of 18. You can use the axisConstraints to keep the x-axis along the bottom of the plot area. If you don't want to use constraints, set the orthogonalPosition to the location of the yRange.
I need to create a line graph on iOS. The graph is a time series, with time along the X axis and a percentage value along the Y axis. I need to be able to set both the X and Y position of each sample, because the samples are not taken at a regular interval (ie. the X axis positions are arbitrary). I do not want to normalise the data to a fixed interval, because that will cause rounding and so on. I have tried Core Plot and JBChartView, but I cannot find any way to set the X positions in either of these libraries.
Is there any way to set the X axis position of each sample in these libraries? I've looked through all the protocols, but it's possible I've missed something.
If it is not possible to set the X axis position in either of those libraries, can you recommend a graphing library that has this functionality?
Thanks!
Look at these Libraries
https://github.com/Boris-Em/BEMSimpleLineGraph
https://github.com/freshking/DynamicGraphView
Hopefully this will help
Core Plot can absolutely do this. The scatterplot pulls data from its datasource independently for the x- and y-values. Most of the included examples just use the data index for the x-value, but that choice was only to make the examples easier to follow. The x-values can be anything. The examples that use a date scale on the x-axis are one demonstration of this feature. The plot values do not need to be evenly spaced; the data is a series of x-y pairs.
I'm using a scatter series in Shinobi Charts but points with maximum and minimum x and y values are being truncated because they're at the edge of the plot area?
How can I add a small margin to the plot area so I can clearly see the scatter points and none are truncated. I realise that I can set the range of each axis myself but that gets into nasty math to work out what a 5px margin would be over the lowest/highest values etc.
There are 2 properties on SChartAxis which can help you: rangePaddingLow and rangePaddingHigh. These values are absolute values, and in the scale of the axis.
For example, if you have an axis which has an automatic range of (0,100), then the following would update the range to (-5, 105):
axis.rangePaddingLow = #5;
axis.rangePaddingHight = #5;
As the axis scale updates, these padding values will be maintained.
Is it possible to achieve different scaling for positive part of Y-axis and different scaling for its negative part of Y-axis.The idea is to show most part of plot area for positive values and less part for negative values.
Set the yRange of the plot space so that 20% of the range is negative. For example, a range with a location of -25 and length of 125 meets this requirement.
I have a strange problem where my x-axis moves down the plot area when I'm plotting less points. My graph has 2 lines plotted - 1 for previous year and 1 for current year values. My original graph always plotted 12 points for both lines, regardless of which month we are in and this works fine. I have now changed my app so that the current year line only plots points upto the current month. E.g. we are in May so I only plot 5 points. When I do this the x-axis moves down the plot area so that it is detached from the y-axis and the labels are hidden - see screenshots :
Why would simply reducing the number of plot points change the x-axis position? I'm using Core Plot 1.1 (static library) and Xcode 4.6.2.
The yRange of the plot space changed so the point where the x-axis crosses the y-axis is now too close to the bottom edge of the graph. You have two options:
Ensure the yRange always puts the crossing point (the "orthogonal coordinate") far enough from the edge that the labels and title remain visible.
Use the axisConstraints to position the axis a fixed distance from the edge of the graph. This will let the crossing point float along the y-axis.
The plotting library changes the x-axis position because generally core plot take the minimum and maximum range among the values of y axis. You when you provide only 5 points then the lowest value is taken from y axis values and there for x- axis position while when you were providing all 12 months values the lowest value of the rest of the month were 0 and therefore x-axis was at zero. You can change the maximum and minimum values for the y range in core plot.