RadChart legend not showing

4 posts, 0 answers
  1. Willem Vastenholt
    Willem Vastenholt avatar
    3 posts
    Member since:
    Mar 2008

    Posted 25 Jan 2011 Link to this post

    Hello,

    I have a question about the RadChart for Silverlight and my situation is as follows;

    I have created a LineSeries RadChart in XAML and I bind it to a nested list with custom business objects (thus I have multiple chartlines to be shown on my ChartArea). In my code behind I fill the nested list and create a ItemMappingCollection with ItemMappings for each DataSeries (XValue with a DateTime and YValue with a double value). In my XAML I have the XAxis defined, which is just a static date definition, for example one week backwards and one week forwards.

    Now when I bind the RadChart with this static XAxis, the chart is plotted correctly but the legend is not showing up. But when I remove the static XAxis definition from my XAML and also remove the ItemMapping for the XValue, the legend is showing correctly but the XAxis just has numeric values, and not the date values I want to show. Then when I decided to just remove the static XAxis definition and keep the ItemMapping for the XValue, I get multiple date values on my XAxis, they overlap each other for every dataseries on the chart.

    Can you point me in the good direction or provide me with a solution for this challenge?

    With kind regards,

    Rick Oonk
    Info Support B.V.
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 25 Jan 2011 Link to this post

    Hello Willem Vastenholt,

    You need to manually associate the ChartLegend with the ChartArea if you are declaring it manually in XAML like this:
    <telerik:RadChart x:Name="RadChart1" >
        <telerik:RadChart.DefaultView>
            <telerik:ChartDefaultView>
                <telerik:ChartDefaultView.ChartArea>
                    <telerik:ChartArea Legend="{Binding ElementName=ChartLegend1}" />
                </telerik:ChartDefaultView.ChartArea>
                <telerik:ChartDefaultView.ChartLegend>
                    <telerik:ChartLegend x:Name="ChartLegend1" />
                </telerik:ChartDefaultView.ChartLegend>
            </telerik:ChartDefaultView>
        </telerik:RadChart.DefaultView>
    </telerik:RadChart>


    Hope this helps.


    Greetings,
    Giuseppe
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Willem Vastenholt
    Willem Vastenholt avatar
    3 posts
    Member since:
    Mar 2008

    Posted 25 Jan 2011 Link to this post

    I cannot remove an attached file so I attached a file with the same name twice. The correct file is the second file with the name "chart-without-static-xaxis-and-xvalue-itemmapping", the legend is showing correctly there. On the other one the legend is not showing because I forgot someting there.
  4. Willem Vastenholt
    Willem Vastenholt avatar
    3 posts
    Member since:
    Mar 2008

    Posted 25 Jan 2011 Link to this post

    Hello Guiseppe,

    That works for me, great! Thnx for the fast reply.

    Greetings,
    Rick Oonk
    Info Support B.V.
Back to Top