XY area chart to show profile data - X axis has non regular intervals

So I'm trying to use the chart to show a profile.   So the x axis are not fixed increment (it could be time or distance) and the y axis is elevation.

As far as I can tell the Line or Area with/without spline would be great except they appear to depend upon the X axis being at fixed regular intervals which the profile data is not.    The X/Y scatter does not really do the job either as it doesnt show a line/area.     

Am I missing something or is this not supported.

5 Replies

YP Yuvaraj Palanisamy Syncfusion Team January 18, 2021 12:54 PM UTC

Hi Spotty,  
  
Greetings from Syncfusion.  
  
We have checked your query and we are not clear about exact requirement. Provided update seems like your requirement is to “show the X axis with non-regular interval data points” if then it has been achieved by setting PrimaryXAxis ValueType as Category.  
   
   
   
chartControl1.PrimaryXAxis.ValueType = ChartValueType.Category;  
   
   
Could you please share us the more details about your exact requirement with pictorial representation and also if possible, please share the example code or sample which will be helpful to provide the better solution at the earliest.  
 
Regards, 
Yuvaraj. 



SP Spotty January 18, 2021 04:51 PM UTC

So here's an example which we have time from a base point in seconds vs value

1 second, 10
3 second, 15
10 second, 18
12 second, 13
19 second 15

So you can plot a line for time vs, value.   But the time are not at regular intervals but are sequentially ordered.     This could use time or perhaps distance vs elevation.    ie.   The GPS points I may gather with elevation would not be at regular distance intervals instances - they would be gathered based upon time and then a distance calculated. 

So I want to simply plot a profile of the data based upon the time vs values.


Categories I would assume would require regular intervals.  




YP Yuvaraj Palanisamy Syncfusion Team January 19, 2021 01:33 PM UTC

Hi Spotty, 
 
We have analyzed your query and achieved your requirement “plot the profile data with non regular intervals” by setting Axis.ValueType as Category and using ChartFormatAxislabel event to format the axis labels as per the below code snippet. 
 
CodeSnippet[C#] 
 
this.chartControl1 = new Syncfusion.Windows.Forms.Chart.ChartControl(); 
this.chartControl1.Size = new Size(500, 500); 
chartControl1.PrimaryXAxis.ValueType = ChartValueType.Category; 
var series1 = new ChartSeries("Series1"); 
ChartDataBindModel dataSeriesModel = new ChartDataBindModel(this.viewModel .Data); 
dataSeriesModel.YNames = new string[] { "YValue" }; 
series1.SeriesModel = dataSeriesModel; 
series1.Type = ChartSeriesType.Line; 
 
chartControl1.ChartFormatAxisLabel += ChartControl1_ChartFormatAxisLabel1; 
this.chartControl1.Series.Add(series1); 
 
private void ChartControl1_ChartFormatAxisLabel1(object sender, ChartFormatAxisLabelEventArgs e) 
{ 
    if(e.AxisOrientation == ChartOrientation.Horizontal) 
    { 
        e.Label = (viewModel.Data[(int)e.Value] as Model).XValue.ToString("mm:ss");  
        e.Handled = true; 
    } 
} 
 
Also, we have prepared the sample for your reference, please find the sample from the below link. 
 
  
Output: 
 
 
Regards, 
Yuvaraj. 



SP Spotty January 19, 2021 04:29 PM UTC

But your example shows the x axis at regular intervals just with different captions.    This is not what is required.   The x axis component of each point are numeric values andneed to be spaced accordingly.


YP Yuvaraj Palanisamy Syncfusion Team January 20, 2021 03:09 PM UTC

Hi Spotty,  
  
We have checked your requirement, and could you please confirm us whether your requirement is to “show the provided data (time) on axis with non-equal interval” based on your confirmation, we can check the possible solution.  
  
We would like to let you know that “show the provided data (time) on axis with non-equal interval” can’t be achieved with default available axis types.  
  
 # DateTime Axis  
  
It is a range-based axis which plots the data points based on the provided data points, but nice interval has been calculated. Hence shows with equal interval  
   
   
For more details, please refer the below link.  
   
#Categorical Axis  
   
Category axis is an index-based axis, and it shows the equal space for providing the non-equal interval data. For more details, please refer the below link  
 
Regards, 
Yuvaraj. 


Loader.
Up arrow icon