2 core-plot graphs with different y axes but the same x axis but with different ranges -
i've got 2 data sets both use date range in x axis. 1 had data entire date range while other has data part of range. (they use independent y axes on left , right , works perfectly.) example:
- 131 data points occurring between 1/1/2015 , 5/1/2015
- 10 data points occurring 4/15/2015 5/1/2015
i want plots superimposed #2 being plotted in upper range of dates.
i create data labels x axis myself setting labels based on 131 data points in #1.
since #2 has 10 data points, need map 10 positions in 131 positions on x axis correspond dates. i've done in numberforplot using array contains map between 10 data points of #2 correct x axis position of set #1.
if ([(nsstring *)plot.identifier isequaltostring:@"pounds"]) { switch (fieldenum) { case cptscatterplotfieldx: return [nsnumber numberwithunsignedinteger:self.xaxismapping[index]]; break; case cptscatterplotfieldy: { plotdata *pd = (plotdata *)self.plotidtoplotdata[plot.identifier]; if (pd != nil) { nslog(@"cptscatterplotfieldy. index: %lu returning: %f\n", (unsigned long)index, [pd yvalue:index]); return([nsnumber numberwithdouble:[pd yvalue:index]]); } } default: break; }
there no documentation on cptscatterplotfieldx enum assumption should take index parameter based on number of data points , return actual position in x axis. need , seems logical design.
problem is, doesn't work; plot of #2 still expands fit entire x axis range.
can help? must common problem 2 graphs share x axis don't have same number of data points or partially cover defined x axis range.
well, on right track numberforplot. fixed problem not call scaletofitplots #2. introduced problem in spite of setting y range correctly, y axis range larger should squishes plot down bottom.
Comments
Post a Comment