I am dynamically plotting on my iPhone from values received from a BLE module using CorePlot. I found the initializer for the CPTLineStyle
class and changed the lineColor
property from black to green. Currently, I am using the CPTPlainBlackTheme
theme class.
My Scatter Plot data line now is green...however, I'm trying to get this new scenario to work. I've added a "Capture" button that starts a timer to collect important data values and store them in an area (current default being 1 minute collection.) As soon as this button is pressed, I want the data line on the graph to go from green to, let's say, white.
Also, as an add on (just to differentiate the difference between the generic and important data), I would like to be able to make the black background get a little lighter, starting at the moment when the Capture button is pressed. Imagine the data line coming in, then, when Capture's pressed, a rectangular square (lighter in color than the plain black background and stretching to the top and bottom of the graph padding) is now covering the data like a grey blanket.
Here's what I've got for the line so far:
CPTMutableLineStyle *anotherLine = [CPTMutableLineStyle lineStyle];
anotherLine.lineColor = [CPTColor whiteColor];
How do I apply this new lineStyle
, and to what object? CPTGraph, CPTScatterPlot, CPTXYPlotSpace?
If you want to change the color of the whole plot line, set the dataLineStyle
to the new style. To make part of the line one color and the rest another color, you'll need to use two plots, one for each color.
For the background, look at the -addAreaFillBand:
method. You can use as many bands as you want. See the "Gradient Scatter Plot" in the Plot Gallery example app for sample code.