Just wanted to post an update here for anyone else that may have a similar problem.
Using the addbarlayer3 method was actually too slow and caused the viewport to lag
when zooming or panning. Peter's way of creating two arrays for two data sets is much
faster and achieves the end goal perfectly.
The code is in C++:
double frequencyBlue[600];
double frequencyGreen[600];
for (int i = 0; i < sizeof(frequencyBlue)/sizeof(frequencyBlue[0]); ++i)
{
frequencyBlue[i] = Boards.count[i];
frequencyGreen[i] = Chart::NoValue;
for (int j = 0; j < sizeof(targetLengths/sizeof(targetLengths[0]); ++j)
{
if (i >= (minLengths[j] * BIN_PER_FOOT) - (MIN_LEN_BRD * BIN_PER_FOOT)
&& i <= (maxLengths[j] * BIN_PER_FOOT) - (MIN_LEN_BRD *
BIN_PER_FOOT))
{
frequencyGreen[i] = Boards.count[i];
frequencyBlue[i] = Chart::NoValue;
}
}
}
// Draw the histogram
BarLayer *histogramLayer = cHistogram->addBarLayer();
histogramLayer->addDataSet(DoubleArray(frequency, (int)
(sizeof(frequency)/sizeof(frequency[0]))),0x6699bb,"Boards");
histogramLayer->addDataSet(DoubleArray(frequency2, (int)
(sizeof(frequency2)/sizeof(frequency2[0]))),0x00CC00,"Boards");
histogramLayer->setDataCombineMethod(Overlay);
Thanks again.
|