Profile Picture

Multi-Series Label Binding, Zoom, Pan

Posted By Kianoosh Ahmadi 9 Months Ago
Author
Message
Kianoosh Ahmadi
Posted 9 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 7 Months Ago
Posts: 4, Visits: 88
What I'm trying to achieve is to create a multi-series (may more than two series) chart like the image below. Vertical axis shows time (maximum 24 hours) and horizontal axes are Y1,Y2 to Yn, representing data changes over time.  I've implemented what I need, but there are some problems that needs to be solved.

https://www.nevron.com/forum/uploads/images/075944a2-9583-43dc-94f2-8ebc.png

First of all I'm using WPF version of Nevon Chart with MVVM and Entity Framework Code First for data storage. I've searched Nevron Chart documentations but it seems Nevon Chart does not support data binding with ObservableCollection nor support MVVM architecture. If I'm wrong please correct me?
So, to get data binding to work, I've created a DataTable object then convert from ObservableCollection to DataTable, And eveything works so good, except for Labels. I cannot binding Label column from DataTable object to Label properties on line series. This is the code I've written so far.


private void BindingChartToData()
{
    NChartControl1.DataBindingManager.AddBinding(0, 0, "XValues", _dataPoints2, "X");
    NChartControl1.DataBindingManager.AddBinding(0, 0, "Values", _dataPoints2 , "Y1");
    NChartControl1.DataBindingManager.AddBinding(0, 0, "Labels", _dataPoints2, "Label");
                                                
    NChartControl1.DataBindingManager.AddBinding(0, 1, "XValues", _dataPoints2, "X");
    NChartControl1.DataBindingManager.AddBinding(0, 1, "Values", _dataPoints2, "Y1");
    NChartControl1.DataBindingManager.AddBinding(0, 1, "Labels", _dataPoints2, "Label");

    NChartControl1.DataBindingManager.UpdateChartControl();
}


It's not showing anything, but when I add labels manually like :


_scaleConfiguratorX = (NLinearScaleConfigurator)_chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator;

for (var j = 0; j < 1000; j++)
{
    _scaleConfiguratorX.Labels.Add(ConvertToTime(j));
}


It would be OK, It will show like the image. What I'm doing wrong?
And, if there is a better way to generate X axis labels, please let me know (I didn't know any better). All data point are generated with two second interval.

My other problem is with implementations of Zoom In(Max: 2 sec interval), Zoom Out(Max: 1 hour interval), Next, Prev, Goto First, Goto Last. So far, I've written some codes and it works, but I feel I'm doing it wrong, I feel there is something in Nevron Chart for the same thing, but I didn't see it. I would be appreciated if anyone take a look at my codes, and say opinions and correct me.



Attachments
MultiChartZoomPan.zip (40 views, 59.00 KB)
Nevron Support Team
This post has been flagged as an answer
Posted 9 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)

Group: Moderators
Last Active: 3 days ago @ 8:33 AM
Posts: 2,593, Visits: 2,279
Hi Kianoosh,
You're binding the labels correctly however these labels annotate the data points, not the categories so you should stick to adding custom labels to the scale configurator if you wish to alter the default category names. Regarding the zooming - it is the correct way to implement it (by setting a NRangeAxiView object) - what problems do you experience? - it looks like its working.


Best Regards,
Nevron Support Team



Kianoosh Ahmadi
Posted 9 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 7 Months Ago
Posts: 4, Visits: 88
Thanks, I just wanted to make sure I'm doing it right




Similar Topics


Reading This Topic