Hello,
I try to bind an HtmlChart with a Custom List<> of object, like so:
--------------------------- C#:
protected void Page_Load(object sender, EventArgs e)
{
RadHtmlChart_LineSeries_Avec_Objet.DataSource = oGetData();
RadHtmlChart_LineSeries_Avec_Objet.DataBind();
}
public class monObjet
{
int ID { get; set; }
decimal ValuePumpA { get; set; }
decimal ValuePumpB { get; set; }
decimal ValuePumpC { get; set; }
decimal ValuePumpD { get; set; }
public monObjet(int id, decimal VPumpA, decimal VPumpB, decimal VPumpC, decimal VPumpD)
{
ID = id;
ValuePumpA = VPumpA;
ValuePumpB = VPumpB;
ValuePumpC = VPumpC;
ValuePumpD = VPumpD;
}
}
public List<monObjet> oGetData()
{
List<monObjet> returnList = new List<monObjet>();
for (int i = 0; i < 12; i++)
{
returnList.Add(new monObjet(i, i+1, i+2, i+3, i+4));
}
return returnList;
}
}
--------------------------- ASPX:
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart_LineSeries_Avec_Objet" Width="1000px" Height="300px" ChartTitle-Text="HtmlChart sur List<objet>">
<PlotArea>
<Series>
<telerik:LineSeries Name="Pump A" DataFieldY="ValuePumpA" ColorField="Yellow" >
<LabelsAppearance Visible="false"/>
</telerik:LineSeries>
<telerik:LineSeries Name="Pump B" DataFieldY="ValuePumpB" ColorField="Green" >
<LabelsAppearance Visible="false"/>
</telerik:LineSeries>
<telerik:LineSeries Name="Pump C" DataFieldY="ValuePumpC" ColorField="Red" >
<LabelsAppearance Visible="false"/>
</telerik:LineSeries>
<telerik:LineSeries Name="Pump D" DataFieldY="ValuePumpD" ColorField="Black">
<LineAppearance LineStyle="Smooth" Width="3" />
<MarkersAppearance BackgroundColor="Red" MarkersType="Circle" Visible="true"/>
<LabelsAppearance Visible="false"></LabelsAppearance>
</telerik:LineSeries>
</Series>
<YAxis>
<LabelsAppearance DataFormatString="{0}"></LabelsAppearance>
</YAxis>
<XAxis>
<Items>
<telerik:AxisItem LabelText="January"></telerik:AxisItem>
<telerik:AxisItem LabelText="Februrary"></telerik:AxisItem>
<telerik:AxisItem LabelText="March"></telerik:AxisItem>
<telerik:AxisItem LabelText="April"></telerik:AxisItem>
<telerik:AxisItem LabelText="May"></telerik:AxisItem>
<telerik:AxisItem LabelText="June"></telerik:AxisItem>
<telerik:AxisItem LabelText="July"></telerik:AxisItem>
<telerik:AxisItem LabelText="August"></telerik:AxisItem>
<telerik:AxisItem LabelText="September"></telerik:AxisItem>
<telerik:AxisItem LabelText="October"></telerik:AxisItem>
<telerik:AxisItem LabelText="November"></telerik:AxisItem>
<telerik:AxisItem LabelText="December"></telerik:AxisItem>
</Items>
</XAxis>
</PlotArea>
<Legend>
<Appearance Visible="true"></Appearance>
</Legend>
</telerik:RadHtmlChart>
But that doesn't work.
Why ?
Thanks for your suggestions