Skip to main content

Microsoft Silverlight

Answered Question Toolkit Chart Template ModifyRSS Feed

(0)

mgreenway@gmail.com
mgreenwa...

Member

Member

0 points

1 Posts

Toolkit Chart Template Modify

I have opened the source of the October Toolkit

Added the Project 

Controls.DataVisualization.Toolkit  to my solution 

Opened up Chart.Xaml 

removed the  

 

  <datavis:Legend x:Name="Legend"
                                    Title="TITLE"
                                    Style="{TemplateBinding LegendStyle}"
                                    Grid.Column="1"/> 

Added a Project Reference to my Silverlgiht application 

Added this to my MainPage.xaml

  

  <Charting:Chart x:Name="Count" Width="600">
                <Charting:ColumnSeries 
        Title="Field Frequency"
        IndependentValueBinding="{Binding Path=Field}"
        DependentValueBinding="{Binding Path=Count}" />
            </Charting:Chart>
 

 And then built my project and the Legend still says: Series 1  and shows a legend

Mog Liang - MSFT
Mog Lian...

All-Star

All-Star

16023 points

1,553 Posts

Answered Question

Re: Toolkit Chart Template Modify

Hi,

I understand that you want to hide legend in chart, then you could apply style to legend by Chart.LegendStyle property to hide it.

Here is sample

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources> <Style TargetType="datavis:Legend" x:Key="ls1">
                <Setter Property="Opacity" Value="0" />
            </Style>
        </Grid.Resources>
        <charting:Chart LegendStyle="{StaticResource ls1}"/>
    </Grid>

 

Thanks,

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

baskarg83
baskarg83

Member

Member

414 points

128 Posts

Answered Question

Re: Toolkit Chart Template Modify

 hey if you want to remove the Legend from you chart,

try this code

 <charting:Chart.LegendStyle>
                                <Style TargetType="Control">
                                    <Setter Property="Width" Value="0"/>
                                    <Setter Property="Height" Value="0"/>
                                </Style>
                            </charting:Chart.LegendStyle>

if it is useful "please mark as Answer"

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities