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

Chart not Binding to Data

11 Answers 429 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 2
Ron asked on 11 Jun 2012, 07:54 PM
I have just upgraded to the new release and was anxious to try out the new HTML chart.  However, I am having an issue with trying to get the chart to bind to an SQL data source adapter.  I know the adapter is returning data as I already have a regular rad chart on the page and a rad grid.  All I did was add the new rad html chart, bind it to the same data source as the grid and regular chart but it does not seem to be working.  Following is my markup for the HTML chart and the regular chart:

<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

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 12 Jun 2012, 11:40 AM
Hello Ron,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ron
Top achievements
Rank 2
answered on 12 Jun 2012, 02:07 PM
I believe I have found the issue which appears to be a bug with the control.  The SQL data source adapter is running a stored procedure on the SQL server and the fields it is returning have spaces in them as you can see from what I am specifying in the markup for the HTML chart (i.e. "Date Ending" and "Messages Processed").  If I change the stored procedure to return column names with no spaces in them such as just "Date" and "Messages", then the chart works no problem.

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.
0
Ron
Top achievements
Rank 2
answered on 13 Jun 2012, 01:41 PM
Hello... I am still waiting on a response for this to confirm if this is a bug and you were able to replicate it?  I would like to proceed with switching over to the new charts but would rather there be a resolution first rather than having to change a lot of other things to get it to work.

Thanks,
Ron
0
Slav
Telerik team
answered on 14 Jun 2012, 10:53 AM
Hello Ronald,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
LV
Top achievements
Rank 1
answered on 15 Jan 2013, 04:26 PM
I'm experiencing the same issue. Is there any workaround to make the RadHtmlChart is bound with the data field with spaces ? I need to show the spaces for legends.
Thanks,
0
Danail Vasilev
Telerik team
answered on 17 Jan 2013, 03:15 PM
Hi all,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Anthony
Top achievements
Rank 1
answered on 12 Feb 2015, 11:45 PM
Has this been added yet? It seems strange to have such a beautiful chart interface but to have the legend unable to have spaces.
0
Danail Vasilev
Telerik team
answered on 13 Feb 2015, 11:22 AM
Hi Anthony,

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.

 
0
Paresh
Top achievements
Rank 1
answered on 08 Jun 2015, 09:50 AM

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.

0
Marin Bratanov
Telerik team
answered on 10 Jun 2015, 09:21 AM

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:

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Paresh
Top achievements
Rank 1
answered on 15 Jun 2015, 10:38 AM
I am agree with you that workaround is easy but such issue is not expected so it take some hours to identify initially.
Tags
Chart (HTML5)
Asked by
Ron
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Ron
Top achievements
Rank 2
Slav
Telerik team
LV
Top achievements
Rank 1
Danail Vasilev
Telerik team
Anthony
Top achievements
Rank 1
Paresh
Top achievements
Rank 1
Share this question
or