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

RadHtml Chart Column Name having special character like '.(dot)' While binding its throwing error

1 Answer 58 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Chary
Top achievements
Rank 1
Chary asked on 24 Apr 2014, 12:57 PM
Hi,

I am trying to Bind RadhtmlChart my column name contains '.' when this appears in the column it is throwing error,how can I handle this.

EX:

       dt.Columns.Add("id");
        dt.Columns.Add("data..."); // This contains '.' at end of column 
    
        DataRow dr = dt.NewRow();       
        dr[0] = "2011-12";
        dr[1] = "500";
        dt.Rows.Add(dr);
        ColumnSeries cs = new ColumnSeries();
        cs.LabelsAppearance.Visible = false;
        cs.Name = dt.Columns[1].ToString();
        cs.DataFieldY = dt.Columns[1].ToString();
        radChart.PlotArea.XAxis.DataLabelsField = dt.Columns[0].ToString();
      
        radChart.PlotArea.Series.Add(cs);
        radChart.PlotArea.YAxis.MinValue = 0;
       
        cs.LabelsAppearance.ClientTemplate = "#= category #";
        cs.TooltipsAppearance.DataFormatString = "{0:N0}";
        cs.TooltipsAppearance.ClientTemplate = "#= category #: #= value #";
        radChart.PlotArea.XAxis.Type = Telerik.Web.UI.HtmlChart.AxisType.Category;
        radChart.PlotArea.XAxis.LabelsAppearance.DataFormatString = "yyyy-MM";
        radChart.PlotArea.Series.Add(cs);
        radChart.PlotArea.XAxis.LabelsAppearance.Visible = true;
        radChart.DataSource = dt;
        radChart.DataBind();

1 Answer, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 29 Apr 2014, 06:10 AM
Hi Chary,

Using special characters (like ".", "\", etc) is not supported when databinding a RadHtmlChart. The reason for this is that the corresponding javascript datasource is created in a custom way before it is sent to the client side.

What I can suggest you in this case is to use a column name without special characters. If you are getting some data from a SELECT statement of your database, you can set an alias for the column name, which does not contain a dot.

Regards,
Stamo Gochev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart (HTML5)
Asked by
Chary
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Share this question
or