<
telerik:RadHtmlChart
ID
=
"RadHtmlChart1"
runat
=
"server"
Height
=
"400"
Width
=
"660"
DataSourceID
=
"MetricsDataSource"
>
<
PlotArea
>
<
Series
>
<
telerik:ColumnSeries
DataField
=
"Messages Processed"
/>
</
Series
>
<
XAxis
DataLabelsField
=
"Date Ending"
>
<
LabelsAppearance
RotationAngle
=
"75"
/>
<
TitleAppearance
Text
=
"Date Ending"
/>
</
XAxis
>
<
YAxis
>
<
TitleAppearance
Text
=
"Messages"
/>
</
YAxis
>
</
PlotArea
>
<
Legend
>
<
Appearance
Visible
=
"false"
/>
</
Legend
>
</
telerik:RadHtmlChart
>
<
telerik:RadChart
ID
=
"MetricsDataChart"
runat
=
"server"
AutoLayout
=
"true"
ChartTitle-Visible
=
"false"
DataSourceID
=
"MetricsDataSource"
DefaultType
=
"Bar"
SeriesOrientation
=
"Vertical"
Height
=
"400"
Width
=
"660"
>
<
Appearance
TextQuality
=
"AntiAlias"
/>
<
Legend
Visible
=
"false"
/>
<
PlotArea
XAxis-Appearance-LabelAppearance-RotationAngle
=
"270"
XAxis-DataLabelsColumn
=
"Date Ending"
XAxis-AxisLabel-Appearance-Visible
=
"true"
XAxis-AxisLabel-TextBlock-Text
=
"Date Ending"
XAxis-LayoutMode
=
"Inside"
YAxis-AxisLabel-Appearance-Visible
=
"true"
YAxis-AxisMode
=
"Extended"
YAxis-AxisLabel-TextBlock-Text
=
"Messages Processed"
/>
</
telerik:RadChart
>
Thanks for your help,
Ron
11 Answers, 1 is accepted
This appears to be working fine with me and I am just using the DataSource from the Databinding to a Database online demo for the RadHtmlChart, as I cannot test your data. You can find this demo and the database it uses (Telerik.mdf) in the LiveDemos folder in your installation so you can compare your case and data. As long as valid data comes in things should work fine. Note that at least the Value column in this case (the one assigned to the BarSeries) must be a number, because the Y-axis is numerical. You can see how this works form in the attached archive where my test page can also be examined.
Regards,
Marin Bratanov
the Telerik team
I tested further by just changing one of the fields to have no spaces, "Messages", while I kept "Date Ending" as is and the results were the values for "Messages" populated in the chart but the "Date Ending" did not. The same situation happened vice versa. The moment I switched the stored procedure back to it's original column names with the spaces, the chart no longer was populating any data again.
In your example, you were not able to reproduce this issue becuase the data fields you specified had no spaces in them. Please retry this scenario using data fields with spaces and verify if the problem reproduces for you?
Unfortunately if this is the case, I would have a lot of SPs I would need to change in order to accomodate the new chart along with any controls that are already using the data adapter and referencing the column names.
Thanks,
Ron
Indeed, the RadHtmlChart is not bound to the specified data source if the DataField includes spaces in its name. This behavior is expected as the data fields need to be set with strings without spaces so that the RadHtmlChart is correctly rendered on the client-side.
If changing the names of the fields in your stored procedure is not an option, you can populate the data in a DataSet, whose columns will be modified accordingly, and data bind the RadHtmlChart to this DataSet.
Note that in general using a space is not recommended in the naming conventions. You can consider not utilizing spaces in your future development to ensure that your code will be applicable in more scenarios.
Do not hesitate to contact us again if you need further assistance with the implementation of RadHtmlChart.
All the best,
Slav
the Telerik team
Thanks,
As my colleagues have already mentioned in their previous posts it is not possble to have space in the name of column which is passed to a databound RadHtmlChart. I have logged your idea in our feedback portal here, and you can monitor, comment or vote on it.
However, I cannot guarantee with any time bound for its implementation, as it should initially get enough votes and then approval from our management. I have updated the Telerik points of both of you for sharing your feedback with us.
Regards,
Danail Vasilev
the Telerik team
Please refer to the RadHtmlChart cannot be bound to a data source that has special characters in its field names. help article for details on the matter.
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.
I am facing same issue with 2015 Q1 version. I think space in column name should not create any issue in 2015 release because it was reported in Jun-2012.
it is acceptable that some illegal character can create issue but space is valid.
Hello Paresh,
One should use the workaround described in the documentation: http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/troubleshooting/common-issues#radhtmlchart-cannot-be-bound-to-a-data-source-that-has-special-characters-in-its-field-names.
There are several factors that are in play for the decision to not fix this scenario:
- there is a very easy workaround
- the issue is not common so there are fixes with greater impact. I have updated the feedback portal page to clearly reflect this: http://feedback.telerik.com/Project/108/Feedback/Details/38687-add-handling-spaces-in-the-names-of-the-columns-which-are-to-be-passed-to-a-datab.
- the fix is by far not trivial, because it has to cater for:
- backwards compatibility
- serializing data between the client and the server
- working properly with pure JS as RadHtmlChart is a wrapper over the Kendo UI Chart
Regards,
Marin BratanovTelerik