Profile Picture

Finding Value-Range of Slider

Posted By praf daw 15 Years Ago
Author
Message
praf daw
Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 2, Visits: 1
Hi,
I am developing an application with Nevron Chart.

I have implemented axis scroll feature in order to allow end user to navigate axis.

I have extracted current view range the scroll bar is showing by registering ScrollBar.EndValueChanged, ScrollBar.BeginValueChanged with suitable event handler.

whenever the position of slider button in the scrollbar changes,the event gets fired and I can obtain view range of the axis via scrollBar.BeginValue and scrollBar.EndValue.

Instead of finding view range of a scrollbar,I actually want to extract the value-range slider button has currently occupied in axes.

Can you please suggest me how can I do it?

Regards,
PND

bob milanov
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Praf,

 

I'm not quite sure what the problem is - as the BeginValue and EndValue properties of the scrollbar actually define the thumb range on the axis - I tested with the following code:

 

private void Form1_Load(object sender, EventArgs e)

{

    // configure chart

    NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

    chart.RangeSelections.Add(new NRangeSelection());

   

    // add dummy data

    NBarSeries bar = new NBarSeries();

    bar.Values.Add(10);

    bar.Values.Add(20);

    bar.Values.Add(30);

    

    chart.Series.Add(bar);

   

    // show scroll bars and intercept begin/value change

    chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;

    chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true;

    chart.Axis(StandardAxis.PrimaryY).ScrollBar.ViewRangeChanged += new EventHandler(ScrollBar_ViewRangeChanged);

   

    // configure interactivity

    nChartControl1.Controller.Tools.Add(new NSelectorTool());

    nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

    nChartControl1.Controller.Tools.Add(new NDataZoomTool());

}

 

void ScrollBar_ViewRangeChanged(object sender, EventArgs e)

{

    NChart chart = nChartControl1.Charts[0];

    label1.Text = chart.Axis(StandardAxis.PrimaryY).ScrollBar.BeginValue.ToString();

    label2.Text = chart.Axis(StandardAxis.PrimaryY).ScrollBar.EndValue.ToString();

}

 

Note that you can also handle Range changed event which is fired when either the begin or end of the scrollbar range is changed.

 

Hope this helps - let me know if you have any questions or comments.

 

Best regards,
Bob



praf daw
Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 2, Visits: 1
Hi Bob,
Thank you for the reply.
I want to explain my problem as follows(Formatting is lost):


Slider Button |--------|
Jan---------Jul---------Sep-----------------------Dec Axes


In above axis scrolling tool, I want to extract the value of July to September i.e. the position the current slider has occupied in the axes.

I do not want to extract the value Jan to Dec which in fact is given by ScrollBar.BeginValue, ScrollBar.EndValue.

Can you please tell me how I can do this?

Regards,
PND

bob milanov
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Praf,

I see - there is no way to reproject the begin-end range again - it will also not be very accurate as at certain sizes the thumb distors the tranform in order to be draggable (this happens when the view range is very very small compared to the original range).

Why is it necessary?

Best regards,
Bob





Similar Topics


Reading This Topic