Chart not Binding to Data

12 posts, 1 answers
  1. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 11 Jun 2012 Link to this post

    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
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 12 Jun 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 12 Jun 2012 Link to this post

    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.
  5. Ron
    Ron avatar
    86 posts
    Member since:
    Sep 2009

    Posted 13 Jun 2012 Link to this post

    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
  6. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 14 Jun 2012 Link to this post

    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.
  7. TJ
    TJ avatar
    1 posts
    Member since:
    May 2012

    Posted 15 Jan 2013 Link to this post

    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,
  8. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 17 Jan 2013 Link to this post

    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.
  9. Anthony
    Anthony avatar
    1 posts
    Member since:
    Oct 2014

    Posted 12 Feb 2015 in reply to Danail Vasilev Link to this post

    Has this been added yet? It seems strange to have such a beautiful chart interface but to have the legend unable to have spaces.
  10. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 13 Feb 2015 Link to this post

    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.

     
  11. Paresh
    Paresh avatar
    11 posts
    Member since:
    Jan 2009

    Posted 08 Jun 2015 Link to this post

    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.

  12. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 10 Jun 2015 Link to this post

    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
  13. Paresh
    Paresh avatar
    11 posts
    Member since:
    Jan 2009

    Posted 15 Jun 2015 in reply to Marin Bratanov Link to this post

    I am agree with you that workaround is easy but such issue is not expected so it take some hours to identify initially.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017