Drag series between axis
Posted: Wed Oct 21, 2009 2:46 pm
How could I drag&drop a serie from a custom axis to another?
Regards,
Juan Luis
Regards,
Juan Luis
Steema Software - Customer Support Forums
https://594668.gxwh.asia/support/
Code: Select all
private void InitializeChart()
{
chartController1.Chart = tChart1;
tChart1.Aspect.View3D = false;
tChart1.Panel.MarginLeft = 15;
tChart1.Zoom.Allow = false;
Steema.TeeChart.Axis axis1 = new Steema.TeeChart.Axis();
Steema.TeeChart.Axis axis2 = new Steema.TeeChart.Axis();
tChart1.Axes.Custom.Add(axis1);
tChart1.Axes.Custom.Add(axis2);
axis1.StartPosition = 0;
axis1.EndPosition = 49;
axis2.StartPosition = 50;
axis2.EndPosition = 100;
for (int i = 0; i < 3; i++)
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
tChart1[i].FillSampleValues();
tChart1[i].CustomVertAxis = (i > 0) ? axis1 : axis2;
}
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
}
private int seriesIndex = -1;
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
seriesIndex = -1;
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (seriesIndex != -1)
{
for (int i = 0; i < tChart1.Axes.Custom.Count; i++)
{
if ((tChart1.Axes.Custom[i].IStartPos <= e.Y) && (tChart1.Axes.Custom[i].IEndPos >= e.Y))
{
tChart1[seriesIndex].CustomVertAxis = tChart1.Axes.Custom[i];
break;
}
}
}
}
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
for (int i = 0; i < tChart1.Series.Count; i++)
{
if (tChart1[i].Clicked(e.X, e.Y) != -1)
{
seriesIndex = i;
break;
}
}
}