Not sure what I'm doing wrong. I cannot databind a RangeBarSeries.
In the below test I took the Demo binding example and added a RangeBarSeries. The Area and Line series show fine but the RangeBar does not show. ( See Attached)
Here is the code:
protected void Page_Load(object sender, EventArgs e)
{
string[] tempTitles = { "In the Heart of the Sea", "The Hunger Games: Mockingjay - Part 2", "Krampus", "The Good Dinosaur", "Creed", "Spectre", "The Night Before", "The Peanuts Movie", "Spotlight", "Brooklyn" };
foreach (string one in tempTitles)
{
RangeBarChart.PlotArea.XAxis.Items.Add(one);
}
List<
MarketShareData
> chromeData = new List<
MarketShareData
>();
chromeData.Add(new MarketShareData(10.8, 23.8));
chromeData.Add(new MarketShareData(11.6, 24.1));
chromeData.Add(new MarketShareData(12.3, 25.0));
chromeData.Add(new MarketShareData(13.6, 25.6));
chromeData.Add(new MarketShareData(14.5, 25.9));
chromeData.Add(new MarketShareData(15.9, 27.9));
chromeData.Add(new MarketShareData(16.7, 29.4));
chromeData.Add(new MarketShareData(17.0, 30.3));
chromeData.Add(new MarketShareData(17.3, 30.5));
chromeData.Add(new MarketShareData(19.2, 32.3));
chromeData.Add(new MarketShareData(20.5, 33.4));
chromeData.Add(new MarketShareData(22.4, 34.6));
RangeBarChart.DataSource = chromeData;
RangeBarChart.DataBind();
}
public class MarketShareData
{
public MarketShareData(double marketShare2010, double marketShare2011)
{
_marketShare2010 = marketShare2010;
_marketShare2011 = marketShare2011;
}
private double _marketShare2010;
public double MarketShare2010
{
get { return _marketShare2010; }
set { _marketShare2010 = value; }
}
private double _marketShare2011;
public double MarketShare2011
{
get { return _marketShare2011; }
set { _marketShare2011 = value; }
}
}
<
telerik:RadHtmlChart
runat
=
"server"
ID
=
"RangeBarChart"
Width
=
"800"
Height
=
"600"
>
<
ChartTitle
Text
=
"All Predictions"
>
<
Appearance
Align
=
"Center"
Position
=
"Top"
></
Appearance
>
</
ChartTitle
>
<
Legend
>
<
Appearance
Position
=
"Bottom"
></
Appearance
>
</
Legend
>
<
PlotArea
>
<
YAxis
>
<
LabelsAppearance
DataFormatString
=
"${0}M"
></
LabelsAppearance
>
<
MinorGridLines
Visible
=
"false"
/>
</
YAxis
>
<
Series
>
<
telerik:RangeBarSeries
Name
=
"Prediction"
DataFromField
=
"MarketShare2010"
DataToField
=
"marketShare2011"
>
</
telerik:RangeBarSeries
>
<
telerik:AreaSeries
Name
=
"Market share in 2010"
DataFieldY
=
"MarketShare2010"
>
</
telerik:AreaSeries
>
<
telerik:LineSeries
Name
=
"Market share in 2011"
DataFieldY
=
"MarketShare2011"
>
</
telerik:LineSeries
>
</
Series
>
</
PlotArea
>
</
telerik:RadHtmlChart
>