Hello,
i am using ultraDataChart. i have isue with zooming scale. zoom is working great without margin.
if add margin (top,left,bottom,right) then zoom is not reflecting the correct value on chart.
namespace Zoom { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { try { AddSeries(); Data_Chart.PlotAreaMarginTop = 5; Data_Chart.PlotAreaMarginBottom = 5; Data_Chart.PlotAreaMarginLeft = 5; Data_Chart.PlotAreaMarginRight = 5; for (int i = 0; i < 11; i++) { DataPoint NewDataPoint = new DataPoint(); NewDataPoint.X = i; NewDataPoint.Y = i * 5; DataPoints.Add(NewDataPoint); } if (Data_Chart.Series.Count < 1) { return; } var _series = Data_Chart.Series[0]; if (_series != null) { Data_Chart.Series[0].DataSource = DataPoints; Data_Chart.Series[0].RenderSeries(false); } if (Data_Chart.Axes[0] is NumericXAxis _xAxis) { _xAxis.RenderAxis(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private List<DataPoint> DataPoints = new List<DataPoint>(); private void AddSeries() { try { var _xAxis = new NumericXAxis { TitleFontSize = 16, TitleTextStyle = FontStyle.Regular, LabelFontSize = 12, LabelTextStyle = FontStyle.Regular }; var _yAxis = new NumericYAxis { TitleFontSize = _xAxis.TitleFontSize, TitleFontFamily = _xAxis.TitleFontFamily, TitleTextStyle = _xAxis.TitleTextStyle, LabelFontSize = _xAxis.LabelFontSize, LabelTextStyle = _xAxis.LabelTextStyle }; // Title for xAxis and yAxis on Signal Chart _xAxis.Title = "Time (ms)"; _yAxis.Title = "Amplitude"; Data_Chart.Axes.Add(_xAxis); Data_Chart.Axes.Add(_yAxis); // Set the series paarmeters var _series = new ScatterLineSeries { XAxis = _xAxis, YAxis = _yAxis, XMemberPath = "X", YMemberPath = "Y", Brush = Color.Blue, Opacity = 1, MarkerType = MarkerType.None, DataSource = DataPoints }; Data_Chart.Series.Add(_series); //Data_Chart.VerticalZoomable = true; //Data_Chart.HorizontalZoomable = true; Data_Chart.IsHorizontalZoomEnabled = true; Data_Chart.IsVerticalZoomEnabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } public class DataPoint { public double X { get; set; } public double Y { get; set; } } }
thank you.
Hello Atif,
Thank you for sharing the code. Using your code I setup a sample using V20.1 attached here.
Now when I run the sample I tried including or excluding the margin and not sure what you mean by zoom is not reflecting the correct value.
Could you please explain the issue using screen shorts or something.
Thank you,Divya Jain
ChartSample.zip
i just Run your ChartSample project. first thing first.
please uncomment the following four line
Data_Chart.PlotAreaMarginTop = 5; Data_Chart.PlotAreaMarginBottom = 5; Data_Chart.PlotAreaMarginLeft = 5; Data_Chart.PlotAreaMarginRight = 5;
because we will use margin. after that try to zoon. i have attached the picture. please take look on xAxis value and its crossponding to yAxis.
for example in the picture xAxis value is 5 which is crosspond to 25 on yAxis which is correct according to datasource.
if I zoom then you will see the value of xAxis 5 is completely changed on yAxis.
Correct (with out Zoom)
Incorrect (with zoom)
May I ask how the problem was finally solved?