Hi,
I'm developing an application in .Net 2.0 in VS 2008, using TeeChart Pro v 3.5.3146.24805. The application shows a chart that has 3 vertical axes on the left and 2 horizontal axes as visual seperators. Is it possible to make these horizontal axes draggable so that the user may resize a verticle axis interactively? Or if you have another suggestion to accomplish this, I'd be glad to hear it!
Interactively resize axes
Re: Interactively resize axes
Hello Remeha,
I suggest you use ColorLine Tool to Drag the axes as do in next example:
Can you tell us if previous code works as you expected?
I hope will helps.
Thanks,
I suggest you use ColorLine Tool to Drag the axes as do in next example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
tChart1.Panel.MarginLeft = 12;
for (int i = 0; i < 3; i++)
{
tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis());
tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());
tChart1[i].FillSampleValues();
tChart1[i].CustomVertAxis = tChart1.Axes.Custom[i];
tChart1[i].GetVertAxis.StartPosition = 33 * i;
tChart1[i].GetVertAxis.EndPosition = 33 * (i + 1);
Steema.TeeChart.Tools.ColorLine colorLine = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
colorLine.Axis = tChart1[i].GetVertAxis;
colorLine.Value = tChart1[i].MinYValue();
colorLine.NoLimitDrag = true;
colorLine.DragLine += new EventHandler(colorLine_DragLine);
}
}
void colorLine_DragLine(object sender, EventArgs e)
{
Steema.TeeChart.Tools.ColorLine colorLine = ((Steema.TeeChart.Tools.ColorLine)sender);
int linePos = colorLine.Axis.CalcPosValue(colorLine.Value);
Rectangle chartRect = tChart1.Chart.ChartRect;
double pos = ((double)(linePos - chartRect.Top) / chartRect.Height) * 100;
colorLine.Axis.EndPosition = pos;
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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 |
Re: Interactively resize axes
This does exactly what i want, thank you! I do have a thought, though... This kind of seems like a bit of a workaround, doesn't it? Wouldn't it make more sense for the axis itself to be draggable? Maybe one for the suggestion box?
I'll use this solution,though
I'll use this solution,though
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Interactively resize axes
Hi Remeha,
Sure! There's no built-in functionality to achieve this right now so I have added your request (TF02015942) to the wish-list to be considered for inclusion in future releases.
Sure! There's no built-in functionality to achieve this right now so I have added your request (TF02015942) to the wish-list to be considered for inclusion in future releases.
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 |
Re: Interactively resize axes
That's great, thanks again. I have no further questions regarding this topic.
Re: Interactively resize axes
Shoot, i do have something to add on this topic: there may be a bug in my version of TeeChart (TeeChart Pro v 3.5.3146.24805). When i hover the mouse over the upper colorline, the cursor changes to a hand. That's good, but the cursor doesn't change when the mouse hovers over one of the other two colorlines. This problem may already have been fixed, since i found it in an older version of TeeChart, can you verify this?
Re: Interactively resize axes
Hello Remeha,
I confirm that it doesn't occurs in last version 3(Build 3.5.3700.30575) so it is fixed.
Thanks,
I confirm that it doesn't occurs in last version 3(Build 3.5.3700.30575) so it is fixed.
Thanks,
Best Regards,
Sandra Pazos / 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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Interactively resize axes
Hi Remeha,
Back to TF02015942, you could do something like in the example below using existing functionality. Does this fit your needs?
Thanks in advance.
Back to TF02015942, you could do something like in the example below using existing functionality. Does this fit your needs?
Code: Select all
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
Steema.TeeChart.Styles.Bar series = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
series.FillSampleValues();
axis = new Steema.TeeChart.Axis(false, false, tChart1.Chart);
tChart1.Axes.Custom.Add(axis);
series.CustomVertAxis = axis;
axis.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
axis.RelativePosition = 50;
tChart1.Zoom.Allow = false;
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (isClicked)
{
axis.RelativePosition = origPos + (e.X - startPos);
tChart1.Invalidate();
}
if (origCursor == null) origCursor = tChart1.Cursor;
if (axis.Clicked(e.Location))
{
tChart1.Cursor = Cursors.VSplit;
}
else
{
tChart1.Cursor = origCursor;
}
}
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
isClicked = false;
tChart1.Invalidate();
}
Steema.TeeChart.Axis axis;
bool isClicked = false;
int startPos;
double origPos;
Cursor origCursor = null;
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
isClicked = axis.Clicked(e.Location);
if (isClicked)
{
startPos = e.X;
origPos = axis.RelativePosition;
}
}
}
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 |