// add your additional code here
<ChartPrimaryXAxis RangePadding="ChartRangePadding.Additional" LabelFormat="dd.MM.yyyy" ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime">
<ChartAxisMajorGridLines Width="0"></ChartAxisMajorGridLines>
<ChartStriplines>
<ChartStripline Start="new DateTime(2021, 3, 2)" End=" new DateTime(2021, 4, 4)" Color="lightgreen" Visible="true">
<ChartStriplineBorder Width="0"></ChartStriplineBorder>
</ChartStripline>
</ChartStriplines>
</ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries Name="Autos & Light Trucks" Type="ChartSeriesType.Line" DataSource="PollutionReports" XName="Period" YName="PollutionRate2" Width="2">
<ChartMarker Visible="true">
<ChartDataLabel Visible="true" Name="text" EnableRotation="true" Alignment="Alignment.Center" Angle="-45" Position="LabelPosition.Outer">
</ChartDataLabel>
</ChartMarker>
</ChartSeries>
</ChartSeriesCollection>
// add your additional code here
@code{
public List<StripLineData> PollutionReports { get; set; } = new List<StripLineData>
{
new StripLineData { Period = new DateTime(2021, 3, 1), PollutionRate1 = 16500, PollutionRate2 = 0, text= "Start engines" },
new StripLineData { Period = new DateTime(2021, 4, 2), PollutionRate1 = 16000, PollutionRate2 = 0, text= "Ignition" },
new StripLineData { Period = new DateTime(2021, 5, 3), PollutionRate1 = 15400, PollutionRate2 = 0, text= "Rotate" },
new StripLineData { Period = new DateTime(2021, 7, 6), PollutionRate1 = 12800, PollutionRate2 = 0, text= "Touch-down" }
};
public class StripLineData
{
public DateTime Period { get; set; }
public double PollutionRate1 { get; set; }
public double PollutionRate2 { get; set; }
public string text { get; set; }
}
} |
// add your additional code here
<SfChart ID="Chart" Title="World Pollution Report">
// add your additional code here
</SfChart>
<style>
#Chart_Series_0_Point_0_Text_0 {
text-anchor: start !important
}
#Chart_Series_0_Point_1_Text_1 {
text-anchor: start !important
}
#Chart_Series_0_Point_2_Text_2 {
text-anchor: start !important
}
#Chart_Series_0_Point_3_Text_3 {
text-anchor: start !important;
}
</style>
// add your additional code here |