RadHtmlChart Special Charachters Issue

13 posts, 0 answers
  1. Chary
    Chary avatar
    13 posts
    Member since:
    Apr 2014

    Posted 13 May 2014 Link to this post

    Hi,
    I am trying to bind RadHtml Chart ,in one of my Column I am having a special character like ' ( ' , so When I am having this(special character) in my column  chart  is  not binding but in earlier version of telerik it used  to bind as expected (2013 version) but after upgrading it to 2014 its not supporting,please let me know the solution for this.

    Thanks,
    Chary.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2014 in reply to Chary Link to this post

    Hi Chary,

    Please have a look into the sample code snippet which works fine at my end. Please try to reproduce the issue in this sample code or provide a sample code for further help.

    ASPX:
    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1">
        <PlotArea>
            <Series>
                <telerik:ColumnSeries Name="Products" DataFieldY="Price">
                    <TooltipsAppearance DataFormatString="${0}" />
                    <LabelsAppearance Visible="false" />
                </telerik:ColumnSeries>
            </Series>
            <XAxis DataLabelsField="Name">
            </XAxis>
            <YAxis>
                <LabelsAppearance DataFormatString="${0}" />
            </YAxis>
        </PlotArea>
        <Legend>
            <Appearance Visible="false" />
        </Legend>
        <ChartTitle Text="Bookstore Products">
        </ChartTitle>
    </telerik:RadHtmlChart>

    C#:
    protected void Page_Load(object sender, System.EventArgs e)
    {
        RadHtmlChart1.DataSource = GetData();
        RadHtmlChart1.DataBind();
    }
    private DataSet GetData()
    {
        DataSet ds = new DataSet("Bookstore");
        DataTable dt = new DataTable("Products");
        dt.Columns.Add("Id", Type.GetType("System.Int32"));
        dt.Columns.Add("Name", Type.GetType("System.String"));
        dt.Columns.Add("Price", Type.GetType("System.Double"));
        dt.Rows.Add(1, "Pen", 5.45);
        dt.Rows.Add(2, "(Audio book)", 9.95);
        dt.Rows.Add(3, "Pencil", 1.99);
        dt.Rows.Add(4, "Book", 15.95);
        dt.Rows.Add(5, "Newspaper", 0.95);
        dt.Rows.Add(6, "Magazine", 3.95);
        ds.Tables.Add(dt);
        return ds;
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chary
    Chary avatar
    13 posts
    Member since:
    Apr 2014

    Posted 14 May 2014 in reply to Shinu Link to this post

    Hi Shinu,

    I mentioned in column name not the Data please see the below modified code,
    private DataSet GetData()

    {   
     DataSet ds = new DataSet("Bookstore");   
     DataTable dt = new DataTable("Products");  
      dt.Columns.Add("Id", Type.GetType("System.Int32")); 
       dt.Columns.Add("(Name)", Type.GetType("System.String")); 
       dt.Columns.Add("(Price)", Type.GetType("System.Double")); 
       dt.Rows.Add(1, "Pen", 5.45);    dt.Rows.Add(2, "(Audio book)", 9.95);
        dt.Rows.Add(3, "Pencil", 1.99);    dt.Rows.Add(4, "Book", 15.95);  
      dt.Rows.Add(5, "Newspaper", 0.95);    dt.Rows.Add(6, "Magazine", 3.95);    ds.Tables.Add(dt);   
     return ds;
    }

    Thanks,
    Chary.

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 19 May 2014 Link to this post

    Hello Chary,

    Generally special characters in field names, passed to the chart, are escaped by surrounding the name with quotes and brackets. For example:

    ASPX:
    <telerik:RadHtmlChart runat="server" ID="ColumnChart"></telerik:RadHtmlChart>
    C#:
    const string DATA_TABLE_NAME = "@1text";
     
    protected void Page_Load(object sender, EventArgs e)
    {
        ColumnChart.DataSource = GetData();
        ColumnChart.DataBind();
    }
     
    protected void Page_Init(object sender, EventArgs e)
    {
        ColumnSeries series = new ColumnSeries();
        series.DataFieldY = "yValue";
        ColumnChart.PlotArea.Series.Add(series);
        ColumnChart.PlotArea.XAxis.DataLabelsField = "[\\'@1text\\']";
    }
     
    protected DataTable GetData()
    {
        DataTable table = new DataTable();
        table.Columns.Add("yValue", typeof(int));
        table.Columns.Add(DATA_TABLE_NAME, typeof(string));
        table.Rows.Add(new object[] { 10, "item 1" });
        table.Rows.Add(new object[] { 20, "item 2" });
        return table;
    }

    It seems, however, that there are special symbols like "(" and ")" that are illegal and cannot be used in DataTable field names. More information on the matter is available in Datacolumn name illegal character forum post.

    Regards,
    Danail Vasilev
    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.

     
  6. Chary
    Chary avatar
    13 posts
    Member since:
    Apr 2014

    Posted 27 May 2014 in reply to Danail Vasilev Link to this post

    Hi Danail,
    This escape character is not working when I am having a dot(.) present in one of my columns,and I am assigning this column to 'datafieldYproperty , So please let me know possible solution for this to work.

    Thanks,
    Chary

  7. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 28 May 2014 Link to this post

    Hi Chary,

    As per Datacolumn name illegal character forum post the following list of characters are invalid in DataTable Column names:
    • ( = open bracket
    • ) = closed bracket
    • [ = open square bracket
    • ] = closed square bracket
    • . = dot
    • / = Slash
    • \ = Backslash
    The list also includes the "." character.

    Regards,
    Danail Vasilev
    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.

     
  8. Chary
    Chary avatar
    13 posts
    Member since:
    Apr 2014

    Posted 30 May 2014 in reply to Danail Vasilev Link to this post

    Hi Danail,

    This used to work in older version of telerik but my concern here is , this  is not working the newer version(When I assign a colum having '(', ')' to datafieldY property ).

    Thanks,
    Chary.
  9. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 03 Jun 2014 Link to this post

    Hi Chary,

    I have made a test and this used to work in the older version of the controls, however, there are too many improvements and features implemented in the control, so that It would be hard to tell you where the difference comes from.

    I can confirm, however, that having special characters in field names is an invalid scenario. Therefore I can suggest that you replace the special symbols with valid ones (i.e., symbols that differ from the ones listed in my previous post).


    Regards,
    Danail Vasilev
    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.

     
  10. small
    small avatar
    2 posts
    Member since:
    Sep 2014

    Posted 17 Sep 2014 Link to this post

    hello there,

    I have the same problem with the special character in the column like,
    dt.rows.add(1," <<osystem ,&" '>> ",25)

    I try the solution but can't work.
    only can draw the plotarea(gridline, label...) but no piechart or bar chart.

    I trace to html and found that the dataSource is wrong cause the ' " '. it was happened at this._dataBind().
    Syntax error: must have '}'

    any solution ?
  11. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 22 Sep 2014 Link to this post

    Hello,

    The quotation marks in the provided DataTable row declaration are not closed properly, which most probably is causing the described problem. Can you replace the provided row with the following one and see whether this will fix the issue?
    dt.Rows.Add( 1, " <<osystem ,&" + " '>> ", 25);

    Regards,
    Vessy
    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.

     
  12. sixto
    sixto avatar
    3 posts
    Member since:
    Apr 2009

    Posted 18 Feb 2015 in reply to Shinu Link to this post

    Hello, I was wondering if someone could help me with a case I have in the RadHtmlChart control and I want to place the property TooltipsAppearance.ClientTemplate LineSeries Grafica as I have a lot of data handling dates section of some occult XAxis.Items so that there is very attached information but time to move the mouse only leave me in the TooltipsAppearance those in the XAxis.Items and those not showing hidden TooltipsAppearance.

    I appreciate if someone could help me with this issue because I've been too many days with the problem and I could not solve it.

    Attached image of the graph to observe as is the TooltipsAppearance when XAxis.Items is hidden.

    thank you very much,
  13. sixto
    sixto avatar
    3 posts
    Member since:
    Apr 2009

    Posted 19 Feb 2015 in reply to sixto Link to this post

    good morning, I wonder if the CategorySeriesItem control supports radhtmchart collection as BubbleSeriesItem.

    properties BubbleSeriesItem
    <telerik: BubbleSeriesItem Y = "35" X = "15" size = "15" Tooltip = "ToolTip1" />

    properties CategorySeriesItem
    <telerik: CategorySeriesItem Y = "1000" />

    Thank You,
  14. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1493 posts

    Posted 20 Feb 2015 Link to this post

    Hello Sixto,

    If you want to display the category in a tooltip you can use the #=category# field in a template. More information is available in the ClientTemplate for Series Labels and Tooltips Overview help article.

    As for the category and bubble items they use different types of primitive and cannot be plotted on a single plot area. Generally category series items are used on category axes which display discrete values. These are items from line, area, bar, column, etc. series. Bubble series like scatter and scatter line use numeric x-axis which display continuous data.

    Regards,
    Danail Vasilev
    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017