We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

2 Questions Regarding LineChart

Thread ID:





109742 Jul 2,2013 04:56 AM Jul 10,2013 07:40 AM WinRT 3
Tags: Chart
Rob Skoon
Asked On July 2, 2013 04:56 AM

Hi There,

     I have successfully embedded a PieChart when I have 1 month's of data.  I am trying to use a LineChart when I have multiple months of data, and I am running into 2 small issues before I can call it done.

1) The sample shows a fixed fill brush value in the LabelTemplate for the DataTemplate.  Is it possible to actually bind whatever the series color is for the Ellipse??  I tried using the following w/o luck:

    <Ellipse Fill="{Binding Interior}" Height="26" Width="26" StrokeThickness="0"/>

2)  I can't figure out how to get the Legend properly bound to the data in the LineSeries().  I see the legend created and it has swatches of the series color, but what property needs to be bound for the Series Title that I want to appear in the Legend text?

Thanks in advance for any advice.

Vinoth Kumar J [Syncfusion]
Replied On July 3, 2013 06:25 AM

Hi Rob,


Thanks for contacting Syncfusion.


We have analyzed your query.


Query 1: Can I bind the Series Interior in LabelTemplate?

We have created a simple sample for binding the Series Interior in the Axis Labels. Please find the sample in the attachment

Query 2: What property of Series is used to bind the Legend Item Title?

The Label property of the Series is used to be as legend item title.


Code Snippet [XAML]:

<chart:LineSeries Label="Legend Title for Series" ItemsSource="{Binding Collection}" XBindingPath="X" YBindingPath="Y" Interior="Red"></chart:LineSeries>


Please let us know if you need further assistance. 


Vinoth Kumar J


Rob Skoon
Replied On July 8, 2013 07:46 PM

This kind of works for what I am trying to do, but if I try to use an ItemTemplate for the legend, I still am unable to get the fill color or the label to bind.  What binding properties should be used?

After incorporating your changes, I am also now seeing a weird behavior in terms of the rendering (see attached screenshot).  On my layout I am switching from a PieChart -> LineChart.  If I refresh the data in the LineChart (Series.Clear() and regenerate / add the new series), it will then display properly.


Vinoth Kumar J [Syncfusion]
Replied On July 10, 2013 07:40 AM

Hi Rob,


Thanks for the update.


You can use any property of LegendItem to the Binding in the ItemTemplate for the ChartLegend. Mostly if you want to bind the series Interior, simply you could bind the Interior property as like in the below code snippet.


Code Snippet [XAML]:


<DataTemplate x:Key="lineChartLegendTemplate">


    <Ellipse Fill="{Binding Interior}" Height="26" Width="26" StrokeThickness="0"/>

   <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"            Text="{Binding Label}"></TextBlock>




We have created a sample based on your requirement and the reported issue is not reproducing with this sample. Can you please check with the sample from the following location? If you still face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you.


Please let us know if you have any queries.



Vinoth Kumar J



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.