// add your additional code here
<ChartSeries DataSource="@ChartData" Name="Germany" XName="xValue" Width="2"
Opacity="1" YName="yValue" Type="ChartSeriesType.Line">
<ChartMarker Shape="ChartShape.Image" Width="36" Height="36" Visible="true" ImageUrl="@MyModelImageProperty">
</ChartMarker>
</ChartSeries>
// add your additional code here
</e-series-collection>
</ejs-chart>
// add your additional code here @code{ private string CurrentUri;
public string MyModelImageProperty = "https://ej2.syncfusion.com/demos/src/tab/images/employees/6.png";
// add your additional code here
} |
The solution that you provided works, but I think he's asking to use a property from the model binded to the Blazor Chart throught the DataSource
If ChartData is like this:
public List<SplineChartData> ChartData = new List<SplineChartData>
{
new SplineChartData { Days = "Sun", MaxTemp = 15, AvgTemp = 10, MinTemp = 2, UrlImage = "https://mysite.com/images/sun.png" },
new SplineChartData { Days = "Mon", MaxTemp = 22, AvgTemp = 18, MinTemp = 12, UrlImage = "https://mysite.com/images/mon.png" },
new SplineChartData { Days = "Tue", MaxTemp = 32, AvgTemp = 28, MinTemp = 22, UrlImage = "https://mysite.com/images/tue.png" },
new SplineChartData { Days = "Wed", MaxTemp = 31, AvgTemp = 28, MinTemp = 23, UrlImage = "https://mysite.com/images/wed.png" },
new SplineChartData { Days = "Thu", MaxTemp = 29, AvgTemp = 26, MinTemp = 19, UrlImage = "https://mysite.com/images/thu.png" },
new SplineChartData { Days = "Fri", MaxTemp = 24, AvgTemp = 20, MinTemp = 13, UrlImage = "https://mysite.com/images/fri.png" },
new SplineChartData { Days = "Sat", MaxTemp = 18, AvgTemp = 15, MinTemp = 8, UrlImage = "https://mysite.com/images/sat.png" }
};
How can I bind the UrlImage property?
I've tried with:
<ChartMarker Shape="ChartShape.Image" Width="36" Height="36" Visible="true" ImageUrl="UrlImage" />
but it doesn't work.
Thanks
Marco