Hi,
I've setup a ColorLine with reference to the bottom axis. When the users drag the ColorLine, I would like to show the sum of Vertical Axis values for one of the line chart to the left of the ColorLine and also the Bottom Axis value.
Is it possible?
Thanks.
ColorLine sum left to it
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: ColorLine sum left to it
Hi pw,
You can use ColorLine events for that, for example:
You can use ColorLine events for that, for example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Tools.ColorLine colorLine1;
private Steema.TeeChart.Styles.Line line1;
private void InitializeChart()
{
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
colorLine1 = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
colorLine1.Axis = tChart1.Axes.Bottom;
colorLine1.DragLine += new EventHandler(colorLine1_DragLine);
colorLine1.EndDragLine += new Steema.TeeChart.Tools.ColorLineToolOnDragEventHandler(colorLine1_EndDragLine);
}
void colorLine1_EndDragLine(object sender)
{
SumValues();
}
void colorLine1_DragLine(object sender, EventArgs e)
{
//SumValues();
}
private void SumValues()
{
double ySum = 0;
for (int i = 0; i < line1.Count; i++)
{
if (line1.XValues[i] <= colorLine1.Value)
{
ySum = ySum + line1.YValues[i];
}
else
{
break;
}
}
tChart1.Header.Text = "Y values sum: " + ySum.ToString() + "\n" +
"ColorLine value: " + colorLine1.Value.ToString("#.####");
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |