OnDataZoom event for NChartControl


Author
Message
Manal Goyal
Manal Goyal
Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)
Group: Forum Members
Posts: 29, Visits: 405
Hi Team,
I am using zoom for both WPF(NChartControl) and Web application(NThinChartControl). Initially I have scale breaks in my chart with zooming enabled, as soon as user zoom into the chart I want to clear scale breaks, I found a way to do that for NThinChartControl in Nevron.Chart.ThinWeb.NDataZoomTool, I set DataZoomCallback and then in OnDataZoom method I have logic to clear scale breaks.

I wanted to know is it possible to have this functionality in NChartControl? Is there any other workaround to achieve what I want to achieve?

Thanks and regards
Manal

Replies
Manal Goyal
Manal Goyal
Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)
Group: Forum Members
Posts: 29, Visits: 405
Hi Team,

Thank you for the solution, it worked for me. However I have one more thing to ask, while dragiing the mouse to zoom in, it shows a horizontal black line for the range on the axis that will be selected to zoom in. Is there any way I can get the pan like zooming that I have for web forms application.

Thanks
Manla

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Manal,

We're not sure what is the problem - do you want to disable the range selection border? In this case you can turn off the ZoomInBorderStyle and ZoomOutBorderStyle:

   NDataZoomTool dataZoomTool = new NDataZoomTool();
   dataZoomTool.ZoomInBorderStyle.Width = new NLength(0);
   dataZoomTool.ZoomOutBorderStyle.Width = new NLength(0);
   nChartControl1.Controller.Tools.Add(dataZoomTool);

If that is not problem - can you send a screenshot of the problem along with the code that configures the control?



Best Regards,
Nevron Support Team


Manal Goyal
Manal Goyal
Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)
Group: Forum Members
Posts: 29, Visits: 405
Please find attached snaps describing my problem.

In the sample nevron app I found this nice rectangle that clearly shows the area I want to zoom in, which looks very good. I want something like that.




This is the code snippet that I have in my application to achieve zooming.


    var chartPlotter = new ChartPlotter(new NevronVisualEntityFactory());
    IScene scene = chartPlotter.CreateMeasuredDeviationsChart(deviations, measurementTime, correctionEvents);

    scene.Render(nChartControl);

    var chart = nChartControl.Charts[0];

    NRangeSelection rangeSelection = new NRangeSelection();
    rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
    ((NCartesianChart)chart).RangeSelections.Add(rangeSelection);
    
    nChartControl.Controller.Tools.Add(new NPanelSelectorTool());
    nChartControl.Controller.Tools.Add(new NAxisScrollTool());
    nChartControl.Controller.Tools.Add(new NDataZoomTool());
    nChartControl.Controller.Tools.Add(new NDataPanTool());

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Manal,
This code looks ok however it is unclear whether you use a single chart panel or multiple chart panels. In case you use a single chart panel with many docked Y axes you also need to specify the vertical axis for the range selection. For example:
rangeSelection.VerticalAxisId = someAxis.AxisId;
You can also send us a snapshot of the chart state:
nChartControl1.Serializer.SaveControlStateToFile("c:\\temp\\chartstate.xml", Nevron.Serialization.PersistencyFormat.CustomXML, null);
(you need to send us the generaed chartstate.xml file) so that we can investigate further.

Hope this helps - let us know if you meet any problems or have any questions.

Best Regards,
Nevron Support Team


Manal Goyal
Manal Goyal
Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)
Group: Forum Members
Posts: 29, Visits: 405
Hi,

I have used a similar way that is present in exmaples->RealTime->RealTimeLine
like this:
NAxis axis1 = chart.Axis(StandardAxis.PrimaryY);
ConfigureAxis(axis1, 0, 30, "Signal 1");

NAxis axis2 = chart.Axis(StandardAxis.SecondaryY);
ConfigureAxis(axis2, 35, 65, "Signal 2");

NAxis axis3 = ((NCartesianAxisCollection)chart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontRight);
ConfigureAxis(axis3, 70, 100, "Signal 3");

I want the range selection box to appear across whole y axis.

I tried what you suggested like:
    NRangeSelection rangeSelection = new NRangeSelection();
    rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
    ((NCartesianChart)chart).RangeSelections.Add(rangeSelection);
    rangeSelection.VerticalAxisId = 1;

but that did not make any difference.

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Manal,
We were not able to replicate the problem - we tested with the following code:
using Nevron.Chart;
using Nevron.Chart.Windows;
using System;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


private void Form1_Load(object sender, EventArgs e)
{
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;

NAxis axis1 = chart.Axis(StandardAxis.PrimaryY);
ConfigureAxis(axis1, 0, 30, "Signal 1");

NAxis axis2 = chart.Axis(StandardAxis.SecondaryY);
axis2.Visible = true;
ConfigureAxis(axis2, 35, 65, "Signal 2");

NAxis axis3 = ((NCartesianAxisCollection)chart.Axes).AddCustomAxis(AxisOrientation.Vertical, AxisDockZone.FrontRight);
ConfigureAxis(axis3, 70, 100, "Signal 3");

NRangeSelection rangeSelection = new NRangeSelection();
rangeSelection.VerticalValueSnapper = new NAxisRulerMinMaxSnapper();
rangeSelection.VerticalAxisId = axis2.AxisId;
chart.RangeSelections.Add(rangeSelection);

NLineSeries line1 = new NLineSeries();
FillData(line1);
chart.Series.Add(line1);

NLineSeries line2 = new NLineSeries();
FillData(line2);
chart.Series.Add(line2);
line2.DisplayOnAxis(StandardAxis.PrimaryY, false);
line2.DisplayOnAxis(axis2.AxisId, true);

NLineSeries line3 = new NLineSeries();
FillData(line3);
chart.Series.Add(line3);
line3.DisplayOnAxis(StandardAxis.PrimaryY, false);
line3.DisplayOnAxis(axis3.AxisId, true);

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

}

private void FillData(NLineSeries line)
{
Random rand = new Random();
line.DataLabelStyle.Visible = false;
for (int i = 0; i < 100; i++)
{
line.Values.Add(rand.Next(100));
}
}

private void ConfigureAxis(NAxis axis, float beginPercent, float endPercent, string text)
{
axis.Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, beginPercent, endPercent);

NLinearScaleConfigurator scale = new NLinearScaleConfigurator();
scale.Title.Text = text;
axis.ScaleConfigurator = scale;
}
}
}

and the control was working properly. Can you sends us a small application that replicates this problem?

Best Regards,
Nevron Support Team


Manal Goyal
Manal Goyal
Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)Forum Member (44 reputation)
Group: Forum Members
Posts: 29, Visits: 405
Hi Team,

where should I send the sample application?

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Manal,

Please send the application to support@nevron.com. Thank you.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Manal Goyal - 7 Years Ago
Nevron Support - 7 Years Ago
Manal Goyal - 7 Years Ago
Nevron Support - 7 Years Ago
Manal Goyal - 7 Years Ago
                         Hi Manal, We're not sure what is the problem - do you want to disable...
Nevron Support - 7 Years Ago
                             Please find attached snaps describing my problem. In the sample...
Manal Goyal - 7 Years Ago
                                 Hi Manal, This code looks ok however it is unclear whether you use a...
Nevron Support - 7 Years Ago
                                     Hi, I have used a similar way that is present in...
Manal Goyal - 7 Years Ago
                                         Hi Manal, We were not able to replicate the problem - we tested with...
Nevron Support - 7 Years Ago
                                             Hi Team, where should I send the sample application?
Manal Goyal - 7 Years Ago
                                                 Hi Manal, Please send the application to support@nevron.com . Thank...
Nevron Support - 7 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search