X-axis and Legends Not Populating from SQL datasource

2 posts, 0 answers
  1. Tom
    Tom avatar
    2 posts
    Member since:
    Jul 2012

    Posted 05 Jul 2012 Link to this post


    I've been creating some graphs using the new Telerik HtmlChart control and have had some issues when trying to allocate a DataLabelField to the X-axis. I have ensured that the table headings have no spaces in them as I read that may be a problem.

    I am using :

    RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "PriorityID"

    The data is displayed in the graph correctly but any attempt to set the x axis is not being applied. The SQL I use provides a column of int (1-12) under the "PriorityID" column heading and a count column of int next to it for the actual data points.

    Also on a similar vein is an issue based around legends. Again the data is being populated but unfortunately displaying a legend that is not being shown correctly. It seems to appear as a line of colours but very small and missing any labels to explain the data. I have included a picture to demonstrate the issue.

    Both these issues are causing serious problems despite the actual graphing of the data being produced, as both limit the relevance of the data shown. Is this due to a shortcoming of the initial version of the control? Or possibly a mismatch between the mappings to take the axis/ legend data out of the datatable?

    Thanks in advance,

  2. Marin Bratanov
    Marin Bratanov avatar
    5935 posts

    Posted 06 Jul 2012 Link to this post

    Hi Tom,

    A PieChart does not have axes at all and this is explained in its online documentation:
    The note paragraphs in each section expose this information.

    On the subject of the legend and its configuration - I advise that you examine the PieChart online demo and go through its configurators right below the chart itself to see how it works and which properties are related to the appearance of the chart: http://demos.telerik.com/aspnet-ajax/htmlchart/examples/charttypes/piechart/defaultcs.aspx. Note that the text in the legend is taken from the name of the seriesItems. Currently they can be set in the code-behind by looping through the items of the series and setting their Name property.

    Kind 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.
Back to Top