You're absolutely right, Bill, it should have been a ScatterLine series, I don't know how I messed up the copy-paste. I fixed it.
Regards,
Marin Bratanov
Progress Telerik
Hi Bill,
Generally, the x-axis Date feature is designed for categorical charts, such as the line chart. This is why the example we have is made with it. If there is an issue with the base unit step issue with it, please open a new ticket and show me an example.
On dates on the x-axis of a scatter chart - that would be possible because dates are actually numbers, but you may lose things like aggregation - each data point would be independent; and there would be no auto-fitting features.
Also, it has not been implemented yet for the scatter charts (numerical x-axis). It would be enabled in a fashion similar to the categorical date axis - by setting the Type and BaseUnit properties, and the new MajorUnit property would let you control the step of the chart. I made this thread public so you can click the Follow button and get notifications for status updates on this feature: https://feedback.telerik.com/blazor/1441432-scatter-chart-with-date-axis.
In fact, even though it is not implemented yet, you could do it by hardcoding lowercase strings like in the following examle (but that would change once we implement it, the Type and BaseUnit will become enumerations):
<TelerikChart>
<ChartSeriesItems>
<ChartSeries Type="ChartSeriesType.ScatterLine"
Data="@Series1Data"
Name="0.8C"
XField="@nameof(ModelData.X)"
YField="@nameof(ModelData.Y)">
</ChartSeries>
</ChartSeriesItems>
<ChartXAxes>
<ChartXAxis Type="date" BaseUnit="days" MajorUnit="3">
<ChartXAxisTitle Text="Time"></ChartXAxisTitle>
<ChartXAxisLabels Format="{0:dd MMM yyyy}"></ChartXAxisLabels>
</ChartXAxis>
</ChartXAxes>
</TelerikChart>
@code {
public class ModelData
{
public DateTime X { get; set; }
public int Y { get; set; }
}
public List<ModelData> Series1Data = new List<ModelData>()
{
new ModelData() { X = DateTime.Now.AddDays(1), Y = 10 },
new ModelData() { X = DateTime.Now.AddDays(2), Y = 20 },
new ModelData() { X = DateTime.Now.AddDays(3), Y = 25 },
new ModelData() { X = DateTime.Now.AddDays(4), Y = 40 },
new ModelData() { X = DateTime.Now.AddDays(5), Y = 50 },
new ModelData() { X = DateTime.Now.AddDays(6), Y = 60 },
new ModelData() { X = DateTime.Now.AddDays(7), Y = 70 },
new ModelData() { X = DateTime.Now.AddDays(8), Y = 80 },
new ModelData() { X = DateTime.Now.AddDays(9), Y = 100 }
};
}
Regards,
Marin Bratanov
Progress Telerik