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

RadHtmlChart Special Charachters Issue

12 Answers 250 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Chary
Top achievements
Rank 1
Chary asked on 13 May 2014, 02:50 PM
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.

12 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2014, 07:28 AM
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.
0
Chary
Top achievements
Rank 1
answered on 14 May 2014, 09:08 AM
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.

0
Danail Vasilev
Telerik team
answered on 19 May 2014, 06:32 AM
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.

 
0
Chary
Top achievements
Rank 1
answered on 27 May 2014, 12:37 PM
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

0
Danail Vasilev
Telerik team
answered on 28 May 2014, 01:14 PM
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.

 
0
Chary
Top achievements
Rank 1
answered on 30 May 2014, 06:38 AM
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.
0
Danail Vasilev
Telerik team
answered on 03 Jun 2014, 11:50 AM
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.

 
0
small
Top achievements
Rank 1
answered on 17 Sep 2014, 09:26 AM
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 ?
0
Vessy
Telerik team
answered on 22 Sep 2014, 06:27 AM
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.

 
0
sixto
Top achievements
Rank 1
answered on 18 Feb 2015, 04:45 PM
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,
0
sixto
Top achievements
Rank 1
answered on 19 Feb 2015, 04:03 PM
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,
0
Danail Vasilev
Telerik team
answered on 20 Feb 2015, 02:47 PM
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.

 
Tags
Chart (HTML5)
Asked by
Chary
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Chary
Top achievements
Rank 1
Danail Vasilev
Telerik team
small
Top achievements
Rank 1
Vessy
Telerik team
sixto
Top achievements
Rank 1
Share this question
or