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

Client Template Special Character Issue

3 Answers 270 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
ahmet
Top achievements
Rank 1
ahmet asked on 12 Sep 2014, 12:05 PM
Hello,
I want to use Client Template in RadHtmlChart but my data's column name has a special character.
My sample is here (in rune time in c#),
TooltipsAppearance.ClientTemplate = "#=dataItem."+variableX+"#";
VariableX value is "T-001" or "T - 001".

How can i define it?

3 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 16 Sep 2014, 01:25 PM
Hi Ahmet,


Special characters in field names, passed to the chart, are escaped by surrounding the name with quotes and brackets
. For example:
ASPX:
<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Width="600px" Height="400px">
</telerik:RadHtmlChart>
C#:
public string variableX = "T-001";
protected void Page_Load(object sender, EventArgs e)
{
    DataTable dt = new DataTable();
    dt.Columns.Add("id");
    dt.Columns.Add(variableX);
    dt.Columns.Add("yValues");
 
    for (int i = 0; i < 5; i++)
    {
        dt.Rows.Add(i, (10 + i).ToString() + " Category", 5 + i);
    }
 
    LineSeries sls1 = new LineSeries();
    sls1.TooltipsAppearance.ClientTemplate = "#=dataItem[\\'T-001\\']#";
    sls1.LabelsAppearance.DataFormatString = "{0:d}";
    RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "[\\'" + variableX + "\\']";
    sls1.DataFieldY = "yValues";
 
    RadHtmlChart1.PlotArea.Series.Add(sls1);
    RadHtmlChart1.DataSource = dt;
    RadHtmlChart1.DataBind();
}

You may also find useful this 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
ahmet
Top achievements
Rank 1
answered on 16 Sep 2014, 02:10 PM
Thanks for your help, it works but i want to use like that
TooltipsAppearance.ClientTemplate = "#=dataItem[\\'" + YAxisColumn + "\\']# - Tarih #= kendo.format(\"{0:yyyy-MM-dd HH:mm}\",dataItem.CREATE_DATE) #";
            LabelsAppearance.DataFormatString = "{0:d}";
This time, don't allow the use of the second data.
Please help once again.
0
ahmet
Top achievements
Rank 1
answered on 16 Sep 2014, 03:22 PM
Ok, my fault. Thank u so musch..
Tags
Chart (Obsolete)
Asked by
ahmet
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
ahmet
Top achievements
Rank 1
Share this question
or