So, I am converting one of my projects that uses CorePlot to Swift. I have a graph that in addition to regular x- and y-axis I add two more. By default, the axis were hidden by the graph. I used the following code in Objective-C to show them over graph:
graph.plotAreaFrame.plotArea.topDownLayerOrder = #[#(CPTGraphLayerTypeAxisLines)];
Here is what it looks like:
I was wondering how do I do that in Swift? I can't seem to set topDownLayerOrder without getting some sort of "can't assign to [AnyObject]!" message
Try this:
graph.plotAreaFrame.plotArea.topDownLayerOrder = [CPTGraphLayerType.AxisLines.rawValue]
With the help of the co-worker, this is what we came up with:
graph.plotAreaFrame.plotArea.topDownLayerOrder = [CPTGraphLayerType.AxisLines.rawValue]
Related
I'm using Chart-Js and am trying to create a radar chart. How do you remove the point values in the image below?
I'm needing to remove the numbers from the dots in the graph. I'm using the default implementation of ng2-charts which is an Angular plugin for Chart.js. I solved the problem by adding this:
Chart.defaults.global.defaultFontSize = 0;
This is probably not the best solution, but it got me past this hump.
Thanks
I want to draw graph using Core Plot Library. I try to customize the x-axis Labels such as shown in attached Image.
this graph have two label on x-axis at one tick location. and title of axis at origin. Can i draw this type of graph using Core Plot or not ? If yes, how i can do this ?
Yes, you can do this. However you will have to use the latest coreplot code from the repository. AFAIK the attributed label formatter support no available yet in the latest official release. With that formatter you can give your labels the form you want (and use only one label with a line break, instead 2).
I am currently trying to create a graph using AChartEngine containing two y-axis (one to the left, one to the right). Yet, I cannot seem to figure out how I can actually add the second y-Axis. An XYMultipleSeriesRenderer only has got one setYTitle() method.
Has someone ever achieved this and can give me a hint?
Thanks,
Matthias
You can do that, indeed. Please see an example for this here.
The result looks like
.
I've a little problem on my graph when using core-plot.
I plot my datas using 2 arrays, 1 for Y axe and 1 for X axe, classic.
My problem is that I have values like this:
Values Array : (
"0.105814",
"0.105828",
"0.1058",
"0.105814",
"0.1058",
"0.105793",
"0.105779",
"0.10575",
"0.10575",
"0.10558"
And when I display the graph, I just see that:
And I don't want one "0,1" but the entire value. I didn't find the parameter so if someone know, I guess it's not really complicated.
Thanks for any help!
PS: And I know it's not "label" like labels are used in core-plot but I don't know how to call it :P
And sorry for my English.
Each axis has a property called labelFormatter. This is a standard NSNumberFormatter. You can create a new formatter that formats the labels any way you want. See Apple's docs for details.
I want to use core-plot for drawing line graph dynamically. data won't come at a time, we will be receiving point by point dynamically.
Is it possible to draw the chart dynamically using core-plot i.e drawing point by point as on when we receive the (x,y) point?
Please help me, Thanks.
Yes, you can do this reasonably easily. For each received data point, append it to an array of values to display. As these data points come in, call -reloadData on the Core Plot graph (or just the particular plot) to redraw the graph, passing in the array you just added a value to in response to the -numbersForPlot:field:recordIndexRange: delegate method.
If you need to adjust the plot range to track your data points (for a moving ticker), recalculate the new CPPlotRange for the X axis and set the plot space's xRange property to that.
Use the CPTestApp-iPhone, AAPLot, or StockPlot examples as templates for how to set up the line chart overall, and modify from that starting point.
I do something similar to this on the Mac in a scientific application:
(source: sunsetlakesoftware.com)
Sounds like you could make use of a demo project I put together and wrote about here (not core plot related though).
It draws a EKG graph but should easily be modified to use another input than the repeated "heart beat"...See line 320 in EAGLView.m where the indata is entered into the array.