I have a chart that looks like this:
The markup is something like:
<SfChart>
<ChartCrosshairSettings Enable="true" LineType="LineType.Vertical" />
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartPrimaryYAxis Minimum="40">
<ChartStriplines>
<ChartStripline Start="70" End="80" Color="#ff000022" />
<ChartStripline Start="80" End="100" Color="#ff000044" />
</ChartStriplines>
</ChartPrimaryYAxis>
<ChartSeriesCollection>
@foreach (var series in DummyTemperatureData)
{
<ChartSeries DataSource="@series.Value" XName="Category" YName="Value" Type="ChartSeriesType.Spline" Name="@series.Key" />
}
</ChartSeriesCollection>
</SfChart>
One thing that's missing here is an extrapolation of previous values. Even though I'm not providing a temperature value for before 0:00:00, I want it to look as though I did. So, I want the left side (and ideally only the left side!) of the lines to keep going (until the left margin of the chart, i.e. the line of the Y axis), ideally perhaps as dashed lines.
It sounds a bit like "range padding" is what I'm looking for, but there's no visual example, and also not enough customization (can't do it only for the left side, and can't change the line shape). Is range padding even for this? Is there a different way of accomplishing this?
Hi Srihari,
would it be possible to define range padding separately for each side? It seems what I'm looking for is something like:
LeftRangePadding="None" RightRangePadding="Auto"
That way, it becomes visually clearer to the user that there is additional data on the left (from the past), but that the right does not continue, because it's in the future.
// add your additional code here
<SfChart ID="chart" Title="NC Weather Report - 2016" Theme="@Theme">
<ChartArea><ChartAreaBorder Width="0"></ChartAreaBorder></ChartArea>
<ChartPrimaryXAxis LabelPlacement="Syncfusion.Blazor.Charts.LabelPlacement.OnTicks" ValueType="Syncfusion.Blazor.Charts.ValueType.Category">
<ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
</ChartPrimaryXAxis>
// add your additional code here
public List<SplineChartData> SplineData = new List<SplineChartData>
{
new SplineChartData { Days = "Sun", MaxTemp = 15, AvgTemp = 10, MinTemp = 2 },
new SplineChartData { Days = "Mon", MaxTemp = 22, AvgTemp = 18, MinTemp = 12 },
new SplineChartData { Days = "Tue", MaxTemp = 32, AvgTemp = 28, MinTemp = 22 },
new SplineChartData { Days = "Wed", MaxTemp = 31, AvgTemp = 28, MinTemp = 23 },
new SplineChartData { Days = "Thu", MaxTemp = 29, AvgTemp = 26, MinTemp = 19 },
new SplineChartData { Days = "Fri", MaxTemp = 24, AvgTemp = 20, MinTemp = 13 },
new SplineChartData { Days = "Sat", MaxTemp = 18, AvgTemp = 15, MinTemp = 8 },
};
protected override void OnInitialized()
{
SplineData.Add(new SplineChartData { Days = " ", MaxTemp = null, AvgTemp = null, MinTemp = null });
}
public class SplineChartData
{
public string Days { get; set; }
public double? MaxTemp { get; set; }
public double? AvgTemp { get; set; }
public double? MinTemp { get; set; }
} |
Hello Srihari,
yes, I think I'm happier with that result. Thank you!
Regards,
Sören