Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Custom Bar Charts with the Silverlight Toolkit

Pete Brown - 09 April 2009

[ Note: this was written using Silverlight 3 Beta and the Silverlight 3 version of the Silverlight Toolkit , but the concepts should work with Silverlight 2 ]

First, a shout out to David Anson and Jafar Husain at Microsoft for helping me through a few sticky issues I ran into while working on this. Any time I’ve asked David for advice on how to do X with charting, he’s been able to come up with a way to do that. Not only is charting built in a really robust way that allows this, but David and his coworkers really know their stuff.

 

Over the past week, I’ve been working on the Silverlight 3 front end for a Microsoft IVC demo application. The whole app incorporates SharePoint, BizTalk and workflow – the Silverlight front end is just a small piece.

The request from Microsoft basically stated:

  • Need to show policy applications in progress
  • Need to show the state of the workflow for each policy application
  • Want it to look like the Microsoft Field Manager demo, meaning similar color scheme and styling
  • Will be hosted in SharePoint chrome later

Beyond that, I pretty much made things up both in terms of functionality and user experience. I did the bitmap graphics in photoshop, and the visuals in a combination of Blend 3 and hand-coded xaml (I tend to do a lot of xaml hand-coding for whatever reason – just can’t break that habit)

One thing I wanted to add to the spec is some simple charting to show off that capability in Silverlight. To do that, I created a dashboard page (I’m using the Silverlight 3 navigation framework, by the way) that had three charts.

Using a variation of my overlay approach for styling pie charts, I was able to make the pie charts look decent pretty quickly. However, I wanted to include a bar chart as well, and I hadn’t experimented with styling bar charts yet.

Here’s what the dashboard finally ended up looking like:

image

Here’s what an out-of-the-box bar chart looks like:

image

And here’s a detail of the bar chart I did. This is the same control as above, just with a different style and template.

image

I used a number of Silverlight 3 features in there which can be simulated in Silverlight 2 either with gradients or pngs. Specifically: the drop shadows around the images, the glow (also a drop shadow) around the bars, the inner glow (a blurred rectangle) inside the bars and the drop shadow behind the analyst names to help them stick out from the photo a little.

Customizing the chart containers/panels is pretty straight-forward. You create a control template either via Blend or by using David Anson’s default style browser, and then work with the styles in there. David has a number of chart styling articles on his site that cover this.

Steps

  • Decide on the chart approach, perhaps using something like the ChartBuilder.
  • Customize the chart template to remove the backgrounds using the approach mentioned above
  • Create custom control template for the bar styles
  • Create or update the style palette to reference the new templates (and new colors)
  • Create a style for the Y axis which references a control template for displaying the pictures and names rather than regular labels
  • Hide the tick marks on both the X and Y axis
  • Create a style for the X axis lines to change them from white to transparent black

 

Object Model

Since I snagged this example from a running application, it will help if you understand the object model just a little. The chart shows performance for analysts in terms of how many open applications vs. how many completed applications. The structures look like this:

public class UserPerformance
{
    public Account UserAccount { get; set; }

    public int OpenItems { get; set; }
    public int CompletedItems { get; set; }

    public int TotalAssignedItems
    {
        get { return OpenItems + CompletedItems; }
    }

}
public class Account
{
    public string LastName { get; set; }
    public string FirstName { get; set; }
    public string UserId { get; set; }
    public Uri AvatarUrl { get; set; }


    public string FullName
    {
        get { return LastName + ", " + FirstName; }
    }
}

I use the same object model in my WCF service and my Silverlight client. In order to allow using the same codebase, while being able to serialize all types (including the enumerations), I have two projects that use Linked Files in Visual Studio 2008. One project targets Silverlight, the other targets the full framework.

image

I then set the chart’s DataContext to an ObservableCollection of the performance objects.

ChartUserPerformance.DataContext = _viewModel.UserPerformance;

There are other ways of binding: for example, you could create a resource for your ViewModel (a pretty good approach) and bind your controls to that. In most cases, that results in less code.

Declare the Chart

The first charting-specific thing to do is to declare the chart. This chart has two custom Axes (X and Y) which I use for styling.

<chartingToolkit:Chart x:Name="ChartUserPerformance"
                       Title="Analyst Performance"
                       Margin="15"
                       BorderBrush="Transparent"
                       Style="{StaticResource PerfomanceBarChartStyle}">

    <chartingToolkit:Chart.Axes>
        <chartingToolkit:CategoryAxis Orientation="Y"
              Location="Left"
              MajorTickMarkStyle="{StaticResource PerformanceChartMajorTickMarkStyle}"
              AxisLabelStyle="{StaticResource PerformanceChartYAxisStyle}">
        </chartingToolkit:CategoryAxis>

        <chartingToolkit:LinearAxis Orientation="X"
            Location="Bottom"
            ShowGridLines="True"
            Foreground="White"
            MajorTickMarkStyle="{StaticResource PerformanceChartMajorTickMarkStyle}"
            GridLineStyle="{StaticResource PerformanceChartGridLineStyle}">
        </chartingToolkit:LinearAxis>

    
    </chartingToolkit:Chart.Axes>
    
    <chartingToolkit:Chart.Series>

        <chartingToolkit:BarSeries Title="Open"
           ItemsSource="{Binding}"
           IndependentValueBinding="{Binding}"
           DependentValueBinding="{Binding OpenItems}">

        </chartingToolkit:BarSeries>

        <chartingToolkit:BarSeries Title="Completed"
           ItemsSource="{Binding}"
           IndependentValueBinding="{Binding}"
           DependentValueBinding="{Binding CompletedItems}">

        </chartingToolkit:BarSeries>

    </chartingToolkit:Chart.Series>

</chartingToolkit:Chart>

 

Note that I declare two different series – one for Open and one for Completed. That’s the source of the two bars per row on the chart. Also note that in those, I bind the IndependentValue to the whole object {Binding}, not just a property. That means that those templates will have access to the everything in the UserPerformance object, including the Account object with its name and avatar properties. I could have bound to just the Account object, but I wasn’t sure what I’d need at the time.

 

Styles

The chart references a few styles which I’ll cover next

 
PerformanceBarChartStyle

This is a big honking style for the whole chart. Most of this is simply the template generated from Blend, but I did tweak a few things. I took the lazy route in a few cases and simply made things transparent instead of removing them from the visual tree. To be efficient, you’d want to generate a control template and remove anything which doesn’t belong.

<Style x:Key="PerfomanceBarChartStyle"
       TargetType="chartingToolkit:Chart">
    <Setter Property="BorderBrush"
            Value="Black" />
    <Setter Property="BorderThickness"
            Value="1" />
    <Setter Property="IsTabStop"
            Value="False" />
    
    <Setter Property="StylePalette">
        <Setter.Value>
            <dataVisualizationToolkit:StylePalette>
                
                <Style TargetType="chartingToolkit:BarDataPoint">
                    <Setter Property="Background"
                            Value="#FF57007f" />
                    <Setter Property="BorderBrush"
                            Value="#FF2e0007" />
                    <Setter Property="Template"
                            Value="{StaticResource PerformanceBarChartBarTemplate}" />
                </Style>
                
                <Style TargetType="chartingToolkit:BarDataPoint">
                    <Setter Property="Background"
                            Value="#FF00757f" />
                    <Setter Property="BorderBrush"
                            Value="#FF2e0007" />
                    <Setter Property="Template"
                            Value="{StaticResource PerformanceBarChartBarTemplate}" />
                </Style>
                
                <Style TargetType="chartingToolkit:BarDataPoint">
                    <Setter Property="Background"
                            Value="#FF007f0f" />
                    <Setter Property="BorderBrush"
                            Value="#FF2e0007" />
                    <Setter Property="Template"
                            Value="{StaticResource PerformanceBarChartBarTemplate}" />
                </Style>
                
                <Style TargetType="chartingToolkit:BarDataPoint">
                    <Setter Property="Background"
                            Value="#FF997f5f" />
                    <Setter Property="BorderBrush"
                            Value="#FF2e0007" />
                    <Setter Property="Template"
                            Value="{StaticResource PerformanceBarChartBarTemplate}" />
                </Style>
                
                <Style TargetType="chartingToolkit:BarDataPoint">
                    <Setter Property="Background"
                            Value="#FF7f2100" />
                    <Setter Property="BorderBrush"
                            Value="#FF2e0007" />
                    <Setter Property="Template"
                            Value="{StaticResource PerformanceBarChartBarTemplate}" />
                </Style>

            </dataVisualizationToolkit:StylePalette>
        </Setter.Value>
    </Setter>
    
    <!-- Style for the title at the top of the chart -->
    <Setter Property="TitleStyle">
        <Setter.Value>
            <Style TargetType="dataVisualizationToolkit:Title">
                <Setter Property="FontSize"
                        Value="16" />
                <Setter Property="HorizontalAlignment"
                        Value="Center" />
                <Setter Property="Margin"
                        Value="0,10,0,10" />
            </Style>
        </Setter.Value>
    </Setter>

    <!-- Style for the legend on the right, also transparent background -->
    <Setter Property="LegendStyle">
        <Setter.Value>
            <Style TargetType="dataVisualizationToolkit:Legend">
                <Setter Property="Margin"
                        Value="15,0,15,0" />
                <Setter Property="VerticalAlignment"
                        Value="Center" />
                <Setter Property="BorderBrush"
                        Value="Transparent" />
                <Setter Property="Background"
                        Value="Transparent" />
            </Style>
        </Setter.Value>
    </Setter>
    
    <Setter Property="ChartAreaStyle">
        <Setter.Value>
            <Style TargetType="Panel">
                <Setter Property="MinWidth" Value="100"/>
                <Setter Property="MinHeight" Value="75"/>
            </Style>
        </Setter.Value>
    </Setter>
    
    <!-- The background for the plot area. I simply made it transparent-->
    <Setter Property="PlotAreaStyle">
        <Setter.Value>
            <Style TargetType="Grid">
                <Setter Property="Background"
                        Value="Transparent">
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>
    
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="chartingToolkit:Chart">
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="10">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <dataVisualizationToolkit:Title Style="{TemplateBinding TitleStyle}"
                                                  Content="{TemplateBinding Title}" />

                        <Grid Margin="0,15,0,15"
                              Grid.Row="1">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <dataVisualizationToolkit:Legend x:Name="Legend"
                                               Style="{TemplateBinding LegendStyle}"
                                               Grid.Column="1"
                                               Title="{TemplateBinding LegendTitle}" />
                            <toolkitChartingPrimitives:EdgePanel x:Name="ChartArea"
                                               Style="{TemplateBinding ChartAreaStyle}">
                                <Grid Style="{TemplateBinding PlotAreaStyle}"
                                      Canvas.ZIndex="-1" />
                                
                                <!-- I removed the border-->
                                <!--<Border Canvas.ZIndex="10"
                                        BorderBrush="#FF919191"
                                        BorderThickness="1" />-->
                            </toolkitChartingPrimitives:EdgePanel>
                        </Grid>

                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
 
PerformanceBarChartTemplate

This control template is referenced from the StylePalette entries in the PerformanceBarChartStyle. This defines the look of each bar on the chart. My changes were primarily to the rectangles and borders used to make the bar.

<ControlTemplate x:Key="PerformanceBarChartBarTemplate"
                 TargetType="chartingToolkit:BarDataPoint">
    <Border BorderThickness="0"
            Opacity="0"
            x:Name="Root">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.1" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Normal" />
                <VisualState x:Name="MouseOver">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="MouseOverHighlight"
                                         Storyboard.TargetProperty="Opacity"
                                         To="0.6"
                                         Duration="0" />
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="SelectionStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.1" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Unselected" />
                <VisualState x:Name="Selected">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="SelectionHighlight"
                                         Storyboard.TargetProperty="Opacity"
                                         To="0.6"
                                         Duration="0" />
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
            <VisualStateGroup x:Name="RevealStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0:0:0.5" />
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Shown">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="Root"
                                         Storyboard.TargetProperty="Opacity"
                                         To="1"
                                         Duration="0" />
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Hidden">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="Root"
                                         Storyboard.TargetProperty="Opacity"
                                         To="0"
                                         Duration="0" />
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        
        <Grid Margin="0 4 0 4">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- Main bar shape -->
            <Rectangle Fill="{TemplateBinding Background}"
                       Stroke="{TemplateBinding BorderBrush}"
                       StrokeThickness="{TemplateBinding BorderThickness}"
                       RadiusX="3"
                       RadiusY="3"
                       Grid.Row="0"
                       Grid.RowSpan="2">
                <Rectangle.Effect>
                    <DropShadowEffect BlurRadius="10"
                                      Direction="0"
                                      Color="#FFFFFFFF"
                                      ShadowDepth="0" />
                </Rectangle.Effect>
            </Rectangle>

            
            <!-- Diffuse Glow -->
            <Rectangle RadiusX="3"
                       RadiusY="3"
                       Margin="4"
                       Grid.Row="0"
                       Grid.RowSpan="2"
                       Opacity=".25"
                       Fill="White"
                       >
                <Rectangle.Effect>
                    <BlurEffect Radius="8" />
                </Rectangle.Effect>
                
            </Rectangle>


            <!-- Specular Highlight -->
            <Rectangle RadiusX="3"
                       RadiusY="3"
                       Margin="2"
                       Grid.Row="0">

                <Rectangle.Fill>
                    <LinearGradientBrush>
                        <GradientStop Color="#99ffffff"
                                      Offset="0" />
                        <GradientStop Color="#22ffffff"
                                      Offset="1" />
                    </LinearGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
            
            <!--<Border BorderBrush="#ccffffff"
                    BorderThickness="1">
                <Border BorderBrush="#77ffffff"
                        BorderThickness="1" />
            </Border>-->
            
            <Rectangle x:Name="SelectionHighlight"
                       Fill="Red"
                       Opacity="0" />
            
            <Rectangle x:Name="MouseOverHighlight"
                       RadiusX="3"
                       RadiusY="3"
                       Fill="White"
                       Opacity="0" />
            
        </Grid>
        <ToolTipService.ToolTip>
            <ContentControl Content="{TemplateBinding FormattedDependentValue}" />
        </ToolTipService.ToolTip>
    </Border>
</ControlTemplate>

 

 

PerformanceChartMajorTickMarkStyle

I use this style simply to hide the tick marks. The tic marks are the little lines that appear outside the plot area to show which value goes with which line. I didn’t think they’d look good in this chart.

<Style x:Key ="PerformanceChartMajorTickMarkStyle" TargetType="Line">
    <Setter Property="Visibility"
            Value="Collapsed" />

</Style>

 

PerformanceChartYAxisStyle

This is the style that gives us the custom template for each item on the Y axis. It consists of a background rectangle with a shadow effect, an image, and a label.

<Style x:Key="PerformanceChartYAxisStyle"
       TargetType="chartingToolkit:AxisLabel">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="chartingToolkit:AxisLabel">                                
                <Grid Margin="0 0 8 0" Width="80" Height="65">
                    
                    <!-- Background rectangle for the photo -->
                    <Rectangle Grid.RowSpan="2"
                               RadiusX="5"
                               RadiusY="5">
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <GradientStop Offset="0"
                                              Color="#FFFFFFFF" />
                                <GradientStop Offset="1"
                                              Color="#FFb6d4e4" />
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                        
                        <Rectangle.Effect>
                            <DropShadowEffect BlurRadius="10"
                                              Direction="0"
                                              Color="#FF000000"
                                              ShadowDepth="0" />
                        </Rectangle.Effect>
                    </Rectangle>
                    
                    <!-- Photo -->
                    <Image Margin="3"
                           Stretch="UniformToFill"
 Source="{Binding UserAccount.AvatarUrl, Converter={StaticResource UriToImageSourceConverter}}"
                           ImageFailed="Image_ImageFailed">
                        <Image.Clip>
                            <RectangleGeometry RadiusX="3"
                                               RadiusY="3"
                                               Rect="0 0 74 59" />
                        </Image.Clip>
                    </Image>

                    <!-- Analyst Name -->
                    <TextBlock HorizontalAlignment="Center"
                               VerticalAlignment="Bottom"
                               FontSize="10"
                               FontWeight="Normal"
                               Foreground="#FFDDEEFF"
                               Margin="4"
                               Text="{Binding UserAccount.FullName}">
                        <TextBlock.Effect>
                            <DropShadowEffect BlurRadius="4"
                                              Direction="0"
                                              Color="#FF000000"
                                              ShadowDepth="0" />
                        </TextBlock.Effect>                                        
                    </TextBlock>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

 

PerformanceChartGridLineStyle

This style sets up the ghosted vertical white lines on the bar chart. It’s a really simple style, just setting the stroke property of the line.

<Style x:Key="PerformanceChartGridLineStyle"
       TargetType="Line">
    <Setter Property="Stroke"
            Value="#55FFFFFF" />

</Style>

 

And that’s it for the styles. I love how Silverlight and WPF lets us dig deeply into the representation of a control and really change around how it looks.

Image Value Converter

"{Binding UserAccount.AvatarUrl, Converter={StaticResource UriToImageSourceConverter}}"

You may have noticed the Url to Image Source value converter. That’s a helper that makes binding Images to Uris possible. I hope this will not be needed in future versions of Silverlight. In case it is, here’s the source for that converter:

public class UriToImageSourceConverter : IValueConverter
{
    #region IValueConverter Members

    public object Convert(object value, Type targetType, 
                            object parameter, CultureInfo culture)
    {

        if (value == null)
        {
            return null;
        }

        if (value.GetType() != typeof(Uri))
        {
            throw new ArgumentException("Expected a Uri type", "value");
        }

        return new BitmapImage((Uri)value);

    }

    public object ConvertBack(object value, Type targetType, 
                                object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }

    #endregion
}

 

There you have it, a highly customized bar chart built using the Silverlight Toolkit, without altering any toolkit code.

Hopefully the demo application will be up on a public site some time in the near future. In case it isn’t, here are a few screen shots of the Silverlight portion.

dashboard workflow status showing tooltip about page

   
posted by Pete Brown on Thursday, April 9, 2009
filed under:    

27 comments for “Custom Bar Charts with the Silverlight Toolkit”

  1. Dansays:
    Excellent, we need to do a similar dashboard in Silverlight and this is a big help. I'm also very interested in hearing more about your workflow status screen. Is this based off of an actual .Net WF?
  2. Pete Brownsays:
    @Dan

    Thanks.

    The workflow status screen has a hard-coded structure, but the status for each will come from a real workflow. If I had time to build the layout engine for arbitrary steps, it could have been done completely dynamically. Had only about a week and change, though.
  3. Fallon Masseysays:
    Hi Pete. I have a comment and a question.

    Comment: This app looks very professional, with some nice touches, i.e. the integration of the pictures with the charts, and the understated styling of the pie charts. I really like the look.

    Question: What is the purpose of this app? Are you guys doing a technology demo, or is this being done for a customer?
  4. Pete Brownsays:
    @Fallon

    Thanks. This is a part of a larger industry-oriented solution demo, not for any specific customer.

    I have an app for a customer that I can't show just yet, but it has some of the same things (charting styles) and a different but IMHO equally interesting look.

    Pete
  5. Chrissays:
    Very nice, Pete.

    When you said "I used a number of Silverlight 3 features in there which can be simulated in Silverlight 2 either with gradients or pngs. Specifically: the drop shadows around the images, the glow ..."

    I was wondering ... is there a performance hit in adding these features? Does SL3 achieve these effects "differently" than SL2?

    As usuual, great article :-)

    Chris
  6. Pete Brownsays:
    @Dan

    The source will come from Microsoft once they put it online; I can't put the downloadable source here. In the mean time, all the markup you need to style is in this post.

    Sorry I can't release more than that right now. It's not mine to give away :P

    Pete
  7. Dansays:
    I'm just running into a problem trying to setup the styles. I'm getting an error on the following line when I attempt to set it up in the app.xaml file:

    <dataVisualizationToolkit:StylePalette>

    Must be missing a reference although I've dropped a chart control into the project.

    Thanks for getting back to me previously. Much appreciated.
  8. Pete Brownsays:
    @Dan

    Yes, you'll need a few namespaces in your xaml. Here they are:

    xmlns:dataVisualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"

    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"

    xmlns:toolkitChartingPrimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"


    Chances are you have one named "datavis" at the top that maps to one of those. You can change that name, remove it or keep it.

    Pete
  9. Dansays:
    Thanks Pete. I have it rocking now that the namespaces were added and it looks great. One other quick question for you:

    If you have a dynamic number of individuals how would you approach the layout? Currently the control has a static width and height specified which works great for 2 or three people. Would you add a scrollbar if there were say 20 people or reduce the size of the pictures, bars, etc?
  10. Paulosays:
    Hey Pete,

    This is a really great looking dashboard. I just started looking into silverlight, and more specifically charts in silverlight, for a work in my company and this post was really interesting.

    This is all still pretty new to me. Right now, I'm building some pie charts and there's something that I thought would be simple to do but it's killing me. I want to change the default tooltip for every pie slice, but after searching through the web for ways of doing it, the only solution I got working changed all the colors of my chart to one single color. I wanted to keep the original colors that Silverlight generated.

    Anyway, thanks for this post! :)

    Paulo
  11. Pete Brownsays:
    @Perico

    It was supposed to end up here:

    http://ivc.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=13385

    But I don't see anything there. Unfortunately the source is not mine to share, other than these blog posts on the topic.

    Pete
  12. Woutersays:
    Great post, looks very nice! I tried to integrate parts of the style into a project I am working on in WPF. For the recent version of WPF Toolkit which contains a port of the SilverLight chart it was announced that the StylePalette has been renamed to Palette.

    I have not been able to get it working in the latest version, could you please help me in the right direction?

    Thanks
  13. vinodsays:
    Hi,
    we are working on silverlight 4 using Blend 4 for UI Designing i want to animate chart , Default it appears in Opacity i want to scale Y-Axis when ever data changes. How can approach to this action.

    thanks
    vinod
  14. Petesays:
    @Vinod

    It has been a while since I played with the charts, and they've changed quite a bit since then. Your best bet is to hit the forums on http://silverlight.net

    Pete
  15. Supersays:
    Hi Pete,

    I am using bubble series charts and am centering the chart area to (0,0) (by setting equal and opposite values to min and max values of x and y axis). Now I need to darken the X-Axis and Y-Axis. Do you have any suggestions on how to proceed?

    Thanks,
    Super
  16. srinivassays:

    Hi,
    I included these three namespaces
    xmlns:chartTool="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:toolkitChartingPrimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:dataVisualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"

    Then also i am getting error
    Error 3 The type 'dataVisualizationToolkit:StylePalette' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.


    Please help me any one

    Thanks
    Srinivas
  17. Briansays:
    I too am getting that same error, and thus I didn't know if this was an updated in a later build of silverlight.
    I am also unable to bind the the username and photo for some reason, and thus I think I might be missing a few things in silverlight 4.
  18. mike from iowasays:
    Hey, that's a TRS-80 program listing in the header of this page huh? Yay for TRS-80 Model I. But that program listing is form a Model II, because it denotes 64K of RAM, and a Model I only went up to 48K !!!
  19. soobersays:
    Hi Pete:
    Great Article, I have one question regarding the X-Axis, some time it in decimal , how can i get rid of these decimal values in x-axis.

    e.g: I have display Qty of items, so the bar start from 0 0.5 1 1.5 like this.

    I want from 0 1 2 3 like this


    Regards

Comment on this Post

Remember me

7 trackbacks for “Custom Bar Charts with the Silverlight Toolkit”

  1. DotNetShoutoutsays:
    Thank you for submitting this cool story - Trackback from DotNetShoutout
  2. Delay's Blogsays:
    It's been a while since the March 09 release of the Silverlight Toolkit - and even longer since I last
  3. Microsoft Weblogssays:
    It's been a while since the March 09 release of the Silverlight Toolkit - and even longer since I last
  4. POKE 53280,0: Pete Brown's Blogsays:
    Thanks again to Marc Schweigert for hosting last night’s DevDinner in Reston. My blog is at www.irritatedVowel.com/Blog
  5. Microsoft Weblogssays:
    In the time since posting my last collection of Silverlight/WPF Charting links , there's been some great
  6. Microsoft Weblogssays:
    In the time since sharing my last collection of Silverlight/WPF Charting links , there have been some
  7. Microsoft Weblogssays:
    In the time since sharing my last collection of Silverlight/WPF Charting links , there have been some