Unable to update chart series display countinuously in 1 sec time interval by billion points as application hang

Hi,

i am currently displaying chart by collection to  chart item source . in collection points are countinuously adding in 1 sec time interval. after some  time number of points becomes very large .
when number of points are very large application got hang.
Please suggest any way or demo by which we can update chart display for large number of points in 1 sec.


Thanks in advance.


28 Replies

MK Muneesh Kumar G Syncfusion Team March 7, 2018 09:59 AM UTC

Hi Anoop Kumar,  
 
Thanks for using Syncfusion products.  
  
We have analyzed your query and we suggest you to use our fast chart types to render huge number of data points in chart. Please finds the below user guide link for more details.  
 
 
Performance sample : C:\Users\<user>\AppData\Local\Syncfusion\EssentialStudio\<product version>\WPF\SfChart.WPF\Samples\Showcase\Performance\CS 
 
Realtime sample : C:\Users\<user>\AppData\Local\Syncfusion\EssentialStudio\<product version>\WPF\SfChart.WPF\Samples\Showcase\Real Time Update\CS 
 
Please let us know if you have any queries.  
  
Regards,  
Muneesh Kumar G. 
 



AK Anoop KUMAR SAHU March 8, 2018 08:28 AM UTC

Hi Muneesh,
Thanks for response.really sf products are very nice.


MK Muneesh Kumar G Syncfusion Team March 9, 2018 10:53 AM UTC

Hi Anoop Kumar,   
 
Thanks for the update. 
  
We are glad to know that the given solution worked. Please get back to us if you need further assistance. 
 
Thanks, 
Muneesh Kumar G. 
 



AK Anoop KUMAR SAHU March 15, 2018 08:22 AM UTC

Dear sir,

 i am looking for point displaying with real time.


MK Muneesh Kumar G Syncfusion Team March 16, 2018 06:53 AM UTC

Hi Anoop Kumar,    
  
As per your requirement we have given real time examples using random data in our previous update. Can you please let us know, what kind of real time data you need. If your requirement is not related to data means please give more information about your requirement that would be helpful for us to provide better solution.  
  
Thanks,  
Muneesh Kumar G.  
  
 



AK Anoop KUMAR SAHU March 16, 2018 09:44 AM UTC

Dear sir,
in the link line displayed between date and value.
i require line display between current time and value.

and currently i am unable to open link -
 C:\Users\\AppData\Local\Syncfusion\EssentialStudio\\WPF\SfChart.WPF\Samples\Showcase\Real Time Update\CS

Please suggest me for open above link.

Thanks


MK Muneesh Kumar G Syncfusion Team March 20, 2018 06:22 AM UTC

Hi Anoop Kumar,     
   
Thanks for your update.  
 
We can achieve your requirement by using DateTime.Now instead of particular date as follows.  
 
Code snippet [C#]: 
 
 
public ObservableCollection<Data> GenerateData() 
{ 
       ObservableCollection<Data> datas = new ObservableCollection<Data>(); 
 
       DateTime date = DateTime.Now; 
.. . 
} 
 
 
We have modified our real time sample based on this, please find the sample from the following location.  
 
   
Thanks,   
Muneesh Kumar G.   
 



AK Anoop KUMAR SAHU March 20, 2018 10:34 AM UTC

Hi Muneesh,

Please suggest how can i acheive below this in CategoryAxis-

 Minimum = Time, Maximum = Time1, SmallTicksPerInterval = 4,

Thanks


MK Muneesh Kumar G Syncfusion Team March 21, 2018 06:53 AM UTC

Hi Anoop Kumar, 
 
We would like to inform you that we don’t have direct support for change Minimum, Maximum and SmallTicksPerInterval in CategoryAxis. But we can achieve your requirement by using ActualRangeChanged event in CategoryAxis as follows.  
 
Code snippet[XAML]: 
 
<chart:CategoryAxis LabelFormat="hh:mm:ss"  
                                    ActualRangeChanged="CategoryAxis_ActualRangeChanged" 
                </chart:CategoryAxis> 
 
Code snippet [C#]: 
 
private void CategoryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            e.ActualMinimum = (double)e.ActualMinimum - 20; 
            e.ActualMaximum = (double)e.ActualMaximum + 20; 
        } 
 
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 



AK Anoop KUMAR SAHU April 23, 2018 06:55 AM UTC

Hi Muneesh,

1 - I want to display last Time Label  always in the bottom of graph (in category axis interval created automatic as per point added per second for real time chart , so last time label always not in bottom of graph)

2 - I want to display point value on mouse left click (not on hover) , graph has two plots and every plots is drawing between Category axis (For Time Displaying hh:mm:ss) and Numerical Axis.
    

Please help me in this regards.


MK Muneesh Kumar G Syncfusion Team April 24, 2018 06:13 AM UTC

Hi Anoop Kumar,  
 
Thanks for your update. Please find the response below. 
 
Query 1 :  I want to display last Time Label  always in the bottom of graph (in category axis interval created automatic as per point added per second for real time chart , so last time label always not in bottom of graph) 
 
You can achieve this requirement by setting Interval property in axis as per data count. Please find the below code snippet. 
 
Code snippet [XAML]: 
<chart:SfChart.PrimaryAxis> 
                <chart:CategoryAxis LabelFormat="hh:mm:ss" Interval="7" 
                                    ActualRangeChanged="CategoryAxis_ActualRangeChanged" 
                                    AxisLineStyle="{StaticResource AxisStyle}"  
                                    MajorTickLineStyle="{StaticResource AxisStyle}"> 
 
                </chart:CategoryAxis> 
            </chart:SfChart.PrimaryAxis> 
 
Output :  
 
 
Please find the below user documentation for more details about interval customization.  
 
 
 
Query 2 :  I want to display point value on mouse left click (not on hover) , graph has two plots and every plots is drawing between Category axis (For Time Displaying hh:mm:ss) and Numerical Axis. 
 
We have achieved this requirement by updating point value in mouse left click as per the below code snippet.  
 
Code snippet [C#]: 
public MainWindow() 
        { 
            ... 
            image.MouseMove += Image_MouseMove; 
            image.MouseLeftButtonUp += Image_MouseLeftButtonUp; 
        }        
 
        private void Image_MouseMove(object sender, MouseEventArgs e) 
        { 
            e.Handled = true; 
        } 
 
        private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 
        { 
            .. 
 
            info = Chart.GetType().GetMethod("UpdateBitmapToolTip", BindingFlags.NonPublic | BindingFlags.Instance); 
            info.Invoke(Chart, null); 
 
        } 
 
We have modified our sample based on this, please find the sample from the following location.  
 
 
Please let us know if you have any queries.  
 
Thanks,
Muneesh Kumar G.
 



AK Anoop KUMAR SAHU April 24, 2018 08:58 AM UTC

Hi Muneesh,

Thanks for update!

I am again explaining my exact requirement.

 i have a graph with two plot, and these two plots can be change any two plots from 6 option in runtime.
so i have to display a popup whenever user click any plot with following information -

Plot Name - Point Value
Time - Time value

i am using MouseLeftButtonDown="Chart1_Sr1_MouseLeftButtonDown" event to acheive plot name but unable to get point value and time.the solution you give me not giving me whole information which is my requirment.

 <syncfusion:FastLineBitmapSeries EnableAntiAliasing="True" Label="Bit Depth"  Name="Chart1_Sr1" XBindingPath="x" YBindingPath="y"    MouseLeftButtonDown="Chart1_Sr1_MouseLeftButtonDown"  >
            </syncfusion:LineSeries>

  private void Chart1_Sr1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            popToolTipSr1.IsOpen = false;
            Point pt = new Point
            {
                X = e.GetPosition(chart1).X - chart1.SeriesClipRect.Left,
                Y = e.GetPosition(chart1).Y
            };
            m1.Content = GraphOptionOne.ChoosePlot1 + " :";
            double x = chart1.PointToValue(chart1.PrimaryAxis, pt);
            double y = chart1.PointToValue(chart1.SecondaryAxis, pt);
            txtSr1Mesurement.Text = String.Format("{0:0.##}", y + 1);
            txtSr1Time.Text = String.Format("{0:0.##}", x);
            popToolTipSr1.IsOpen = true;
        }

for better understanding please see attach two zip folders .(this UI screen is old build of my app , the only  different is now displaying time in hh:mm:ss)

Please help me in this regards.




Attachment: Graph_Option_890ff8d1.zip


AK Anoop KUMAR SAHU April 24, 2018 09:01 AM UTC

Please see this attach zip

Attachment: Desktop_641fc771.zip


MK Muneesh Kumar G Syncfusion Team April 25, 2018 09:23 AM UTC

Hi Anoop Kumar,   
  
Thanks for your update. 
 
We have analyzed your query and we have found that you have raised MouseLeftButtonDown event in FastLineBitmapSeries in your application. We would like to inform you that we have drawn all fast series in single WriteableBitmap. So please use MouseLeftButtonDown in SfChart as below.  
 
Code snippet [C#]: 
 
 
public MainWindow() 
        { 
            InitializeComponent(); 
 
            Chart.MouseLeftButtonDown += Chart_MouseLeftButtonDown; 
        } 
 
 
In this event we can get complete details by checking series hit test by invoking IsHitTestSeries method and find nearest point using FindNearestChartPoint method as below.  
 
Code snippet [C#]: 
private void Chart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
        { 
            MethodInfo info = Chart.GetType().GetMethod("GetAdorningCanvas", BindingFlags.NonPublic | BindingFlags.Instance); 
 
            var adorningCanvasPoint = e.GetPosition(info.Invoke(Chart, null) as Canvas); 
 
            FieldInfo fieldInfo = Chart.GetType().GetField("adorningCanvasPoint", BindingFlags.NonPublic | BindingFlags.Instance); 
            fieldInfo.SetValue(Chart, adorningCanvasPoint); 
 
            Point mousePoint = e.GetPosition(image); 
 
            foreach (var series in Chart.Series) 
            { 
                info = series.GetType().GetMethod("IsHitTestSeries", BindingFlags.NonPublic | BindingFlags.Instance); 
                var hitTest = (bool)info.Invoke(series, null); 
 
                if (hitTest) 
                { 
                    double x, y, stackY; 
                    adorningCanvasPoint.X = adorningCanvasPoint.X - Chart.SeriesClipRect.Left; 
                    series.FindNearestChartPoint(adorningCanvasPoint, out x, out y, out stackY); 
 
                    if (!double.IsNaN(x)) 
                    { 
                        var data = (series.ItemsSource as ObservableCollection<Data>)[(int)x]; 
 
                        //you can use these values in your popup 
                        var seriesLabel = series.Label; 
                        var date = data.Date; 
                        var value = y; 
                    } 
                } 
            } 
        } 
 
We have modified our sample based on this, please find the sample from the following location. 
 
 
Please let us know if you have any queries.  
 
Thanks,
Muneesh Kumar G.
 



AK Anoop KUMAR SAHU April 25, 2018 11:04 AM UTC

Hi Muneesh,
Thanks for update.
Sorry,The solution given you in my one earlier query not working , Please see attach my two images (LikeThis and NotLikeThis) in this i have explain my requirement by some mark.

Query was-----
Query 1 :  I want to display last Time Label  always in the bottom of graph (in category axis interval created automatic as per point added per second for real time chart , so last time label always not in bottom of graph) 
 
You can achieve this requirement by setting Interval property in axis as per data count. Please find the below code snippet. 
 
Code snippet [XAML]: 
<chart:SfChart.PrimaryAxis> 
                <chart:CategoryAxis LabelFormat="hh:mm:ss" Interval="7" 
                                    ActualRangeChanged="CategoryAxis_ActualRangeChanged" 
                                    AxisLineStyle="{StaticResource AxisStyle}"  
                                    MajorTickLineStyle="{StaticResource AxisStyle}"> 
 
                </chart:CategoryAxis> 
            </chart:SfChart.PrimaryAxis> 


Attachment: RediffMail.201921524653778_c74ad28f.zip


AK Anoop KUMAR SAHU April 25, 2018 11:08 AM UTC

Every second data is adding in graph , so last time label some above from bottom edge of graph.

Please help me in this regards.


MK Muneesh Kumar G Syncfusion Team April 26, 2018 07:30 AM UTC

Hi Anoop Kumar,     
 
We can resolve this problem by using DateTimeAxis as primary axis and we can show edge labels by setting EdgeLabelsVisibilityMode as AlwaysVisible and Interval as follows.  
 
Code snippet [XAML]: 
<chart:SfChart.PrimaryAxis> 
                <chart:DateTimeAxis LabelFormat="hh:mm:ss" Interval="25" IntervalType="Seconds" 
                                    ActualRangeChanged="CategoryAxis_ActualRangeChanged" 
                                    EdgeLabelsVisibilityMode="AlwaysVisible" 
                                   x:Name="dateTimeAxis" 
                                    AxisLineStyle="{StaticResource AxisStyle}"  
                                    MajorTickLineStyle="{StaticResource AxisStyle}"> 
                    <chart:ChartAxis.Header> 
                        <TextBlock Margin="10" Text="Time" FontSize="16" FontFamily="SegoeUI"/> 
                    </chart:ChartAxis.Header> 
                </chart:DateTimeAxis> 
            </chart:SfChart.PrimaryAxis> 
 
 
We can customize the range by setting VisibleMinimum and VisibleMaximum in ActualRangeChanged event as follows.  
 
Code snippet [C#]: 
private void CategoryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            e.VisibleMinimum = view.DynamicData[0].Date; 
        } 
 
 
We have modified our sample based on this, please find the sample from the following location. 
 
 
If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you. 
Thanks,
Muneesh Kumar G.
 
 
 
 




AK Anoop KUMAR SAHU April 26, 2018 09:02 AM UTC

Hi Muneesh,
Thanks for update,

I will reponse my feedback after implementation on my project.

very very thanks.


AK Anoop KUMAR SAHU April 26, 2018 10:21 AM UTC

Hi Muneesh,
This is not working in my project.
Now, i am attaching my own project Please correct in my project.

in my project i am populating graph on log.xaml page , in this page Three graph each contain Two plot i have apply your solution in First graph For Duration 5 Min .
To run Graph first select Duration 5 Min From Graph1 Option (Click on "Graph1 Option" button page control window will open to select option) and Click Start Log Button to start Graph. check  BindGraph(); Method by this i am applying setting .

Before this , my project is integrated to Hardware so, when you run project Com port setting window open click on Connect (Due to hardware not connected so, some 1-3
exceptions will come click Ok on exception project will run and will open with log window)
Please download from below link as max attach size is 30 mb in this site.

https://www.dropbox.com/s/fh0l0i6rkw10h2g/DtDropBox.zip?dl=0


MK Muneesh Kumar G Syncfusion Team April 27, 2018 11:02 AM UTC

Hi Anoop Kumar,    
 
We have analyzed your sample, we found that you have created new DateTimeAxis in code behind for each time Duration change. In that time ActualRangeChanged event not hooked for new axis and EdgeLabelsVisibilityMode property also not set. We can resolve this by using below solutions.  
 
Solution 1 : We can resolve this by hooking ActualRangeChanged event and setting EdgeLabelsVisibilityMode for new axis as per the below code snippet.  
 
Code snippet [C#]: 
.. 
 
if (Chart1_Sr2.XAxis != null) 
  Chart1_Sr2.XAxis.ActualRangeChanged -= XAxis_ActualRangeChanged; 
 
Chart1_Sr2.XAxis = new DateTimeAxis()  
{ 
IntervalType = DateTimeIntervalType.Seconds, 
EdgeLabelsVisibilityMode=EdgeLabelsVisibilityMode.AlwaysVisible, 
ShowGridLines = false, LabelFormat = "hh:mm:ss" 
}; 
Chart1_Sr2.XAxis.LabelRotationAngle = 270; 
Chart1_Sr2.XAxis.ActualRangeChanged += XAxis_ActualRangeChanged; 
 
.. 
 
private void XAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
{ 
  if (CommonGlobal.Bit != null && CommonGlobal.Bit.Count > 0) 
    e.VisibleMinimum = CommonGlobal.Bit[0].x; 
} 
 
.. 
 
 
Solution 2 : We can resolve this by using existing axis for each time Duration update as per the below code snippet. 
 
Code snippet [C#]: 
 
.. 
 
DateTimeAxis axis = Chart1_Sr2.XAxis as DateTimeAxis; 
 
if (axis == null) 
{ 
 axis = new DateTimeAxis(); 
 Chart1_Sr2.XAxis = axis; 
} 
 
axis.IntervalType = DateTimeIntervalType.Seconds; 
axis.EdgeLabelsVisibilityMode = EdgeLabelsVisibilityMode.AlwaysVisible; 
axis.ShowGridLines = false; 
axis.LabelFormat = "hh:mm:ss"; 
axis.LabelRotationAngle = 270; 
 
.. 
 
private void CategoryAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
{ 
  if (CommonGlobal.Bit != null && CommonGlobal.Bit.Count > 0) 
    e.VisibleMinimum = CommonGlobal.Bit[0].x; 
} 
 
 
Output : 
 
 
Please refer below user documentation for more details.  
 
 
Please let us know if you have any queries.  
 
Thanks,
Muneesh Kumar G.
 
 
 



AK Anoop KUMAR SAHU April 30, 2018 12:07 PM UTC

Hi Muneesh,
 thanks for response.
I want every MajorGridLine should have Time Label.
and other Time label interval display on MinorGridLine (between two MajorGridLine there will be 4 MinorGridLine as display in Numerical axis).
Maximum Time label (Which is on bottom of Graph should not greater than current time.)
Beside this,In the begning i was displaying Time in minuts so for this in code behind for each time Duration change i scaled axis as ----
For 5 Min-
 chart1.PrimaryAxis = new NumericalAxis() { Minimum = 0, Maximum = 5, SmallTicksPerInterval = 4, MaximumLabels = 5 };
                        chart1.PrimaryAxis.LabelRotationAngle = 270;
                        chart1.PrimaryAxis.MajorGridLineStyle = chart1.Resources["MajorGridLineStyle"] as Style;
                        chart1.PrimaryAxis.Visibility = Visibility.Collapsed;

For 2 Hr-
chart1.PrimaryAxis = new NumericalAxis() { Minimum = 0, Maximum = 120, SmallTicksPerInterval = 4, MaximumLabels = 5 };
                        chart1.PrimaryAxis.LabelRotationAngle = 270;
                        chart1.PrimaryAxis.MajorGridLineStyle = chart1.Resources["MajorGridLineStyle"] as Style;
                        chart1.PrimaryAxis.Visibility = Visibility.Collapsed;

But now instead of NumericalAxis i am using DateTimeAxis for displaying time in hh:mm:ss  .
Now i want , when user select 5 Min duration after 2 Hr. or 15 Min pass , plot display only between previous 5 min data with current value.
I am adding and removing data in collection every second as below-
Below method executing in every 1 sec time interval with help of BackgroundWorker .
private void DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                BackgroundWorker worker = sender as BackgroundWorker;
                while (!worker.CancellationPending)
                {
                    if (GP < 7201)
                    {
                        GP = GP + 1;
                    }
                    
                    if (CommonGlobal.StartGraph == true)
                    {
                        RemPoi = false;
                        if ( GP == 7201)
                        {
                            RemPoi = true;
                        }
                        if (GraphOptionCommon.DurationValue == 60 && GP >= 3601)
                        {
                            RemPoi = true;
                        }
                        if (GraphOptionCommon.DurationValue == 30 && GP >= 1801)
                        {
                            RemPoi = true;
                        }
                        if (GraphOptionCommon.DurationValue == 15 && GP >= 901)
                        {
                            RemPoi = true;
                        }
                        if (GraphOptionCommon.DurationValue == 5 && GP >= 301)
                        {
                            RemPoi = true;
                        }
                        Time = DateTime.Now;// Time + 0.0166667; // 1 sec in minute and increasing time by 1 sec
                        AddValueInCollectionForPopulateGraph(); // graph value adding in collection, if selected time duration over then removing data per second
                    }
                    Thread.Sleep(1000);
                }
            }
            catch (Exception ex)
            { }
        }

 public void AddValueInCollectionForPopulateGraph()
        {
            try
            {
                this.Dispatcher.Invoke((Action)delegate
                {
                    if (RemPoi == true)
                    {
                        GP = GP - 1;
                        CommonGlobal.Bit.RemoveAt(0);
                        CommonGlobal.Rop.RemoveAt(0);
                        CommonGlobal.Hole.RemoveAt(0);
                        CommonGlobal.Block.RemoveAt(0);
                        CommonGlobal.Hook.RemoveAt(0);
                        CommonGlobal.Wob.RemoveAt(0);
                        CommonGlobal.TotalW.RemoveAt(0);
                    }
                    CommonGlobal.Bit.Add(new BitDepth()
                    {
                        x = Time,
                        y = BitDepthWithExistingUnit,
                    });
                    CommonGlobal.Rop.Add(new Rop()
                    {
                        x = Time,
                        y = RopValueWithExistingUnit,
                    });
                    CommonGlobal.Hole.Add(new HoleDepth()
                    {
                        x = Time,
                        y = HoleDepthWithExistingUnit,
                    });
                    CommonGlobal.Block.Add(new BlockPos()
                    {
                        x = Time,
                        y = BlockDepthWithExistingUnit,
                    });
                    CommonGlobal.Hook.Add(new HookLoad()
                    {
                        x = Time,
                        y = HookLoadWithExistingUnit,
                    });
                    CommonGlobal.Wob.Add(new Wob()
                    {
                        x = Time,
                        y = WobValueWithExistingUnit,
                    });
                    CommonGlobal.TotalW.Add(new TotalWeight()
                    {
                        x = Time,
                        y = TotalWeightWithExistingunit,
                    });
                });
            }
            catch (Exception ex)
            { MessageBox.Show("Error in graph populating."); }
        }

Kindly help me in this regards.


MK Muneesh Kumar G Syncfusion Team May 1, 2018 02:13 PM UTC

Hi Anoop Kumar,     
 
Please find the response below.  
  
Query 1 : I want every MajorGridLine should have Time Label. 
 
We can achieve this by setting ShowGridLines property as true as per the below code snippet.  
 
Code snippet[C#]: 
   axis.ShowGridLines = true; 
   axis.LabelFormat = "hh:mm:ss"; 
 
Please refer below user documentation for more details.  
 
 
Query 2 :  Other Time label interval display on MinorGridLine (between two MajorGridLine there will be 4 MinorGridLine as display in Numerical axis). 
 
We can achieve this requirement by setting SmallTicksPerInterval property in axis as per the below code snippet. 
 
Code snippet[C#]: 
   axis.IntervalType = DateTimeIntervalType.Seconds; 
   axis.SmallTicksPerInterval = 4; 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G. 
 



AK Anoop KUMAR SAHU May 4, 2018 05:00 AM UTC

Hi Muneesh,

Thanks for your response.

I am still waiting for the response on the below issue as this has became on higher priority, please provide the solution ASAP.
 Maximum Time label (Which is on bottom of Graph should not greater than current time.)


Thanks in advance!

Looking forward :) 




MK Muneesh Kumar G Syncfusion Team May 8, 2018 06:32 PM UTC

Hi Anoop Kumar,      
 
Please find the response below.   
 
Query : Maximum Time label (Which is on bottom of Graph should not greater than current time.) 
 
We can achieve this requirement by using CustomDateTimeAxis in series axis and setting VisibleMinimum, VisibleMaximum in ActualRangeChanged event as per the below code snippet.  
 
Code snippet[C#]:  
   case "5 Min": 
         ... 
 
        Chart1_Sr2.XAxis = new CustomDateTimeAxis() 
        { 
             Interval = 25, 
             IntervalType = DateTimeIntervalType.Seconds, 
             ShowGridLines = true, 
             LabelFormat = "hh:mm:ss", 
             EdgeLabelsVisibilityMode = EdgeLabelsVisibilityMode.AlwaysVisible 
        }; 
        Chart1_Sr2.XAxis.ActualRangeChanged += XAxis_ActualRangeChanged; 
         ... 
 
        private void XAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            if (CommonGlobal.Bit != null && CommonGlobal.Bit.Count > 0) 
            { 
                e.VisibleMinimum = CommonGlobal.Bit[0].x; 
                if (CommonGlobal.Bit.Count > 0) 
                    e.VisibleMaximum = CommonGlobal.Bit[CommonGlobal.Bit.Count - 1].x; 
            } 
        } 
    ... 
    public class CustomDateTimeAxis : DateTimeAxis 
    { 
        protected override void GenerateVisibleLabels() 
        { 
            base.GenerateVisibleLabels(); 
 
            VisibleLabels[VisibleLabels.Count-1]= new DateTimeAxisLabel( 
                    VisibleRange.End, 
                    VisibleRange.End.FromOADate().ToString( 
                        LabelFormat, 
                        CultureInfo.CurrentCulture), 
                        VisibleRange.End); 
        } 
    } 
  
Please let us know if you have any queries.   
  
Thanks,  
Muneesh Kumar G.  
 



AK Anoop KUMAR SAHU May 10, 2018 09:17 AM UTC

Hi Muneesh,
Thanks for response.
Please attach my project where you did changes.
You can give share link by uploading in Dropbox.


MK Muneesh Kumar G Syncfusion Team May 11, 2018 06:12 PM UTC

Hi Anoop Kumar,  
 
We have done the changes in “5 Min” duration in BindGraph method. Please find the modified project in below location.  
 
 
Please let us know if you have any queries.  
 
Thanks, 
Muneesh Kumar G 



AK Anoop KUMAR SAHU May 14, 2018 05:33 AM UTC

Hi Muneesh,
Thanks for your response.
1 - Given solution working good.but when we click on plot for getting exact point exception is coming as "Index out of range....".
could you please help.

 2 - Please suggest me some reference for Auto scale feature in graph.


MK Muneesh Kumar G Syncfusion Team May 15, 2018 11:07 AM UTC

Hi Anoop Kumar,   
  
Please find the response below.  
 
Query 1: Given solution working good. but when we click on plot for getting exact point exception is coming as "Index out of range....". 
could you please help. 
 
We have analyzed your query and found that the exception thrown due to you have used x value as index. But the x value is DateTime. We have resolved this problem by converting x value to DateTime as per the below code snippet.  
 
Code snippet[C#]: 
  private void Chart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
        { 
            ... 
                        switch (seriesLabel) 
                        { 
                           case "Bit Depth": 
                                date = DateTime.FromOADate(x); 
                                value = y; 
                                break; 
 
 
Query 2: Please suggest me some reference for Auto scale feature in graph. 
 
ActualRangeChanged event have called when axis range is changed, so we can achieve auto scaling in axis by updating axis Minimum and Maximum in ActualRangeChanged event as per the below code snippet We can customize view range using visibleRange field in below.  
 
Code snippet [XAML]: 
private void XAxis_ActualRangeChanged(object sender, ActualRangeChangedEventArgs e) 
        { 
            int visibleRange = 5; 
 
            if (CommonGlobal.Bit != null && CommonGlobal.Bit.Count > 0) 
            { 
                if (CommonGlobal.Bit.Count > visibleRange) 
                    e.VisibleMinimum = CommonGlobal.Bit[CommonGlobal.Bit.Count - visibleRange].x; 
                else 
                    e.VisibleMinimum = CommonGlobal.Bit[0].x; 
 
                if (CommonGlobal.Bit.Count > 0) 
                    e.VisibleMaximum = CommonGlobal.Bit[CommonGlobal.Bit.Count - 1].x; 
            } 
        } 
 
Please refer below user documentation for more details about axis range customization.  
 
Please let us know if you have any queries.  
  
Thanks,  
Muneesh Kumar G  
 


Loader.
Up arrow icon