Kevin Sweeney Guest
|
Posted: Fri Aug 20, 2004 5:46 pm Post subject: TeeChart Pro 4.01 |
|
|
Hi,
I have noticed a problem in an application I created with two charts
using TeeChart Pro 4.01, and cannot figure it out. The first chart
shows a bunch of time-based data; the second shows the same data
intepreted as binary (the Y-axis represents the two's power, and a
different colored box is drawn to indicate whether that bit is on in
the data; the result looks like a grid of red- or white-filled boxes).
The application allows the user to click on one of the bit boxes in
order to toggle its state. It changes the color of the clicked box on
the second chart, recalculates the value of the original data, then
redraws the point at the new value on the first chart (by deleting the
old value, then adding a new point with the new value):
void __fastcall TQP4_4::SeriesClick( TChartSeries *Sender,
int ValueIndex, TMouseButton Button, TShiftState Shift,
int X, int Y )
{
TColor color = Series2->ValueColor[ ValueIndex ]; // bit color
Chart2->Series[0]->ValueColor[ ValueIndex] = ( color == clRed ) ?
clWhite : clRed; // toggle bit box color
int index = ... ; // determine the index to the original data
{ ... }; // modify original data point per bit change
double xval = index; // set X and Y values for new point
double yval = data[ index ];
Chart1->Series[0]->Delete( index ); // delete old TROUBLE
Chart1->Series[0]->AddXY( xval, yval, NULL, clRed ); // add new
}
This code seems to do everything I want, except that the line marked
TROUBLE also deletes the same indexed point from Chart2, like it is
performing:
Chart2->Series[0]->Delete( index );
I must be doing something incorrectly. Does anyone have any ideas?
Thanks in advance.
Kevin Sweeney
|
|