0

For a chart I have created a scroll bar which enables itself when the X Axis data points reaches a specific limit.

The problem which I'm facing is that the scroll is working in opposite direction my chart image, hiding the new data points.

Here is the example of the effect which I want to achieve.

My code snippet:

int ix = chartTrend.Series["Ok Parts"].Points.AddXY(process.time, process.okCount);
            
if (chartTrend.Series["Ok Parts"].Points.Count > 8)
{
    chartTrend.ChartAreas[0].AxisX.Minimum = double.NaN;
    chartTrend.ChartAreas[0].AxisX.Maximum = double.NaN;
    chartTrend.ChartAreas[0].RecalculateAxesScale();
    chartTrend.ChartAreas[0].AxisX.ScaleView
              .Zoom(chartTrend.Series["Ok Parts"].Points[ix - 8 ].XValue, 
                    chartTrend.Series["Ok Parts"].Points[ix].XValue);
TaW
  • 53,122
  • 8
  • 69
  • 111
  • Did you set the DateTimeIntervalType for the series? You may want to try using [this overload](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datavisualization.charting.axisscaleview.zoom?view=netframework-4.8#System_Windows_Forms_DataVisualization_Charting_AxisScaleView_Zoom_System_Double_System_Double_System_Windows_Forms_DataVisualization_Charting_DateTimeIntervalType_) – TaW Mar 09 '21 at 15:34
  • Hello @TaW thank you so much, the time interval is in seconds and I have set the value of DateTimeIntervalType to 8 as mentioned in the documentation but still I'm facing the same issue, may be you can guide me on how to do it correctly – Nikunj Gaur Mar 11 '21 at 07:02

0 Answers0