This is a migrated thread and some comments may be shown as answers.

Can't bind RangeBar

2 Answers 47 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Iron
Andy asked on 13 Dec 2015, 08:59 PM

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>

2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 15 Dec 2015, 12:00 PM

Hi Andy,

You need to make sure the data fields match the actual field names in the data source as they are case sensitive:

<telerik:RangeBarSeries Name="Prediction" DataFromField="MarketShare2010" DataToField="MarketShare2011">
</telerik:RangeBarSeries>


Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andy
Top achievements
Rank 1
Iron
answered on 15 Dec 2015, 04:23 PM
Thanks... that was a stupid mistake on my part... especially since I had the correct ones right below
Tags
Chart (HTML5)
Asked by
Andy
Top achievements
Rank 1
Iron
Answers by
Marin Bratanov
Telerik team
Andy
Top achievements
Rank 1
Iron
Share this question
or