Set borders (min,max) to drag chart with right mouse button
Set borders (min,max) to drag chart with right mouse button
Hello, could You help me. I need to set restrictions for the chart dragging with right mouse button for user. I mean that user couldn't drag chart holding right mouse button to the area with values out of the range (less then Min and larger then Max). How can I do it? Thanks for reply.
Re: Set borders (min,max) to drag chart with right mouse button
Hello starnov,
I have made a simple, that I think you could use it in your application. Please, check next code works as you want.
I hope will helps.
Thanks,
I have made a simple, that I think you could use it in your application. Please, check next code works as you want.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Line line1;
private void InitializeChart()
{
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Scroll += new EventHandler(tChart1_Scroll);
}
void tChart1_Scroll(object sender, EventArgs e)
{
if (tChart1.Axes.Bottom.Maximum > line1.MaxXValue() || tChart1.Axes.Bottom.Minimum < 0)
{
tChart1.Axes.Bottom.AutomaticMinimum = false;
tChart1.Axes.Bottom.Minimum = 0;
tChart1.Axes.Bottom.AutomaticMaximum = false;
tChart1.Axes.Bottom.Maximum = line1.MaxXValue();
}
if (tChart1.Axes.Left.Maximum > line1.MaxYValue() || tChart1.Axes.Left.Minimum<0)
{
tChart1.Axes.Left.AutomaticMinimum = false;
tChart1.Axes.Left.Minimum = line1.MinYValue();
tChart1.Axes.Left.AutomaticMaximum = false;
tChart1.Axes.Left.Maximum = line1.MaxYValue();
}
}
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 |