I know it can be done in the chart editor, but Is there any way to change the margings of the panel with the mouse dragging the axis of the graph?
Thanks in advance
Change the margins of the panel with the mouse
Re: Change the margins of the panel with the mouse
Hello wakeup,
I think you could use property ,of tChart1 Panel, for change size of margins(MarginBottom,MarginLeft,MarginRight,MarginTop) in the Scroll Event, because every time you want do scroll margins change their size as you want. Following you can find an example how you do for change size of margins:
I hope will helps.
Thanks,
I think you could use property ,of tChart1 Panel, for change size of margins(MarginBottom,MarginLeft,MarginRight,MarginTop) in the Scroll Event, because every time you want do scroll margins change their size as you want. Following you can find an example how you do for change size of margins:
Code: Select all
tChart1.Panel.MarginBottom = 30;
tChart1.Panel.MarginLeft = 30;
tChart1.Panel.MarginRight = 20;
tChart1.Panel.MarginTop = 20;
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: Change the margins of the panel with the mouse
Sorry, I understand you mean about change the margin in the panel with that code. But how can I use the scroll event to modify each margin independently?
Do you have any example?
Thanks
Do you have any example?
Thanks
Re: Change the margins of the panel with the mouse
Hello wakeup,
Sorry for delay. I have made a simple code that I think you can use in your application. Please, check next code works as you want.
I hope will helps.
Thanks,
Sorry for delay. I have made a simple code that I think you can use in your application. Please, check next code works as you want.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
double OldMarginLeft, OldMarginTop, OldMarginRight,OldMarginBottom;
private void InitializeChart()
{
Steema.TeeChart.Styles.Line series = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series.FillSampleValues();
OldMarginLeft = tChart1.Panel.MarginLeft;
OldMarginTop = tChart1.Panel.MarginTop;
OldMarginRight= tChart1.Panel.MarginRight;
OldMarginBottom= tChart1.Panel.MarginBottom;
tChart1.Scroll += new EventHandler(tChart1_Scroll);
tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
}
void tChart1_UndoneZoom(object sender, EventArgs e)
{
tChart1.Axes.Bottom.SetMinMax(tChart1[0].XValues.Minimum, tChart1[0].XValues.Maximum);
tChart1.Panel.MarginLeft = OldMarginLeft;
tChart1.Panel.MarginTop = OldMarginTop;
tChart1.Panel.MarginRight = OldMarginRight;
tChart1.Panel.MarginBottom = OldMarginBottom;
}
void tChart1_Scroll(object sender, EventArgs e)
{
tChart1.Panel.MarginLeft = tChart1.Panel.MarginLeft+0.5;
tChart1.Panel.MarginTop = tChart1.Panel.MarginTop+0.5;
tChart1.Panel.MarginRight = tChart1.Panel.MarginRight + 0.5;
tChart1.Panel.MarginBottom= tChart1.Panel.MarginBottom + 0.5;
}
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: Change the margins of the panel with the mouse
Thanks Sandra, it's a good trick.
But I need to move each margin independently, and its a bit dirty zoom and scrooll the chart to move the margins. And if I disable the zoom the event doesn't fire...
But I need to move each margin independently, and its a bit dirty zoom and scrooll the chart to move the margins. And if I disable the zoom the event doesn't fire...
Re: Change the margins of the panel with the mouse
Hello wakeup,
Sorry for the delay. If you want to move each margin independently I suggest you use 4 different ScrollBars,one for each margin, so you can change size of margins using values of ScrollBars and their events.
I hope will helps.
Thanks,
Sorry for the delay. If you want to move each margin independently I suggest you use 4 different ScrollBars,one for each margin, so you can change size of margins using values of ScrollBars and their events.
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: Change the margins of the panel with the mouse
That seems to be the best option. Thanks a lot!