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.
Related
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
I want to extract the peek value from a plot automatically.
I searched web plot digitizer and other programs and packages, however none of them gives points on the plot automatically. Is there any way to achieve this by using image processing such as CNN ?
I am thinking to make custom filters to find peek point.
Thanks in advance.
Sample plot
Algorithm
convert to gray-scale and binarize
find coorditates of a white pixel (x,y) where y is minimal nonzero values
add to y the blob radius y=y+r
make the scale transformation from range [0,image_height] to your range [0,25]
calculate new value of y under the transformation
Right now I am trying to understand the values within an ARKit transform matrix so I can quantify the movements of my SCNNode. From a previous post on stack overflow I have learned that the matrix contains information regarding the node's current translation, scale, rotation, and position.
What I am not understanding is which values are specifically associated with those four things. For example I have figured out that the first element of the 3rd column represents an X (horizontal) movement on the screen and the 2nd value of the 3rd column represents a Y (vertical) movement. But other than that I'm not sure what the rest of the values in the matrix mean.
Thanks for the help!
In a transformation matrix, the translation information is in the last column.
Given a transformation matrix, you can extract the translation from the last column as below:
let translation = SCNVector3(transform.columns.3.x, transform.columns.3.y, transform.columns.3.z)
Rotation and scaling use the first three columns and are more complex.
Scale is the length of the first three column vectors, and to extract the rotation you need to divide the first three column vectors by the scaling factors just mentioned.
You can refer to this link for a better understanding of scale and rotation and how to extract them.
MohammadRF's answered cleared things up for me the best. However, ARKit's matrices are in row-major order so if you were to transpose the matrices from the information he gave then it would apply to ARKit.
i have three points in 2D and I want to draw a spline curve passing through them. How do I calculate the middle point (x1 and y1 as in quadTo)? i want to implement free curve like denon eq curve
For the first segment of the curve, you can probably use addQuadCurveToPoint, picking a control point with the same y value as the second point (and I picked an x value half way between the two end points):
For the second portion of the curve, you can't use quad curve, because you need two control points (or, you'd have to break it up into two quad curves, which is more hassle than its worth, IMHO). So use addCurveToPoint, using control point y values that are the same value as the y value of the point to which the control point refers (and, again, I picked x values half way between the x values of the two end points):
There are lots of permutations of this idea, but I hope this illustrates the concept. I'd suggest you start playing around with UIBezierPath and addCurveToPoint until you achieve the desired effect.
I have a Highcharts scatter plot with a datetime x axis. The x values are all in the past. The y coordinates are positive integers, typically in the range 100..10k. I want to draw lines from the imaginary point (tomorrow, 0) back to some of the data points.
The Renderer's path command looks to take absolute coordinates in chart space. How do I transform the point (tomorrow,0) into those absolute coordinates?
Also, assume the data was from 1995..2005. The default auto-scaling of Highcharts would make tomorrow be off the chart to the right. What will happen when drawing the path? Will the chart remain the same scale and the line be clipped at the right-hand edge? (That would be OK). Would the chart be redrawn with a new scale so that the x axis covered the whole span from 1995 to tomorrow? Something else?
Thanks in advance...
Found it. There is a translate() function to do the conversion. See the Highcharts support forum thread for info on the function.
Use Axis.toPixels() and Axis.toValue()