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

RadChart legend not showing

3 Answers 138 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Willem Vastenholt
Top achievements
Rank 1
Willem Vastenholt asked on 25 Jan 2011, 10:31 AM
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.

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 25 Jan 2011, 10:57 AM
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>>
0
Willem Vastenholt
Top achievements
Rank 1
answered on 25 Jan 2011, 10:57 AM
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.
0
Willem Vastenholt
Top achievements
Rank 1
answered on 25 Jan 2011, 11:01 AM
Hello Guiseppe,

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

Greetings,
Rick Oonk
Info Support B.V.
Tags
Chart
Asked by
Willem Vastenholt
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Willem Vastenholt
Top achievements
Rank 1
Share this question
or