<div class="control-section">
<button onclick="@dataChange">Change the Data</button>
<EjsChart id="container" width="60%">
<ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Double">
</ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries dataSource="@dataSource" xName="xValue" yName="yValue" name="India" type="ChartSeriesType.Bar">
</ChartSeries>
</ChartSeriesCollection>
</EjsChart>
</div>
@functions{
public class ChartData
{
public double xValue;
public double yValue;
public double yValue1;
}
List<ChartData> dataSource = new List<ChartData> {
new ChartData { xValue = 10, yValue = 21 },
new ChartData { xValue = 20, yValue = 24 },
new ChartData { xValue = 30, yValue = 36 },
new ChartData { xValue = 40, yValue = 38 },
new ChartData { xValue = 50, yValue = 54 },
new ChartData { xValue = 60, yValue = 57 },
new ChartData { xValue = 70, yValue = 70 },
};
void dataChange()
{
this.dataSource = new List<ChartData> {
new ChartData { xValue = 20, yValue = 55 },
new ChartData { xValue = 40, yValue = 15 },
new ChartData { xValue = 60, yValue = 75 },
};
}
} |