Working with Steema TeeChart graphs. (In particular objects: TChart, TChartSeries, TBarSeries, TLineSeries)
My task is to dynamically combine graphs when user selects some of the them, their values are added or subtracted based on XLabel value.
So this is what I get after selecting a couple of graphs and then deselecting them (which does the following:
- Sets Series with DefaultBar/LineSeries
- Adds values of selected graphs to the DefaultBar/LineSeries
- Subtracts values of deselected graphs from the DefaultBar/LineSeries)
Result (logically) has to be 0 for all XLabels
Here are some of the values:
Can I somehow keep the actual values instead of rounded values (the ones represented on the graph), so that I will not have any rest after subtraction procedure?
I could do something like this to get rid of the rest (I know that the values will be big):
//bad solution
for Serie := 0 to Chart.SeriesCount - 1 do
for YValue := 0 to Chart.Series[Serie].YValues.Count - 1 do
if StrToFloat(FormatFloat('0.00', Chart.Series[Serie].YValue[YValue])) = 0 then
Chart.Series[Serie].YValue[YValue] := 0;
But this is not a very great solution - not scalable.
Probably related:
When I select only 1 graph and deselect it, then all the values are 0, the problem occurs when multiple graphs are selected (addition occurs)