BarSeries & PointSeries Setter

2 posts, 0 answers
  1. Lee
    Lee avatar
    30 posts
    Member since:
    Apr 2014

    Posted 14 May 2014 Link to this post


    I wonder two thing.

    1. I want to set BarWidth.

    In case of PointSeries, < Setter Property="PointSize" Value=.../>

    But I don't look for that.

    2. I want to set Color of BarSeries & PointSeries.

    The color is 'Stroke' in LineSeries.


    I want that setting is available property.
  2. Martin Ivanov
    Martin Ivanov avatar
    1410 posts

    Posted 19 May 2014 Link to this post

    Hi Lee,

    Let me get straight to your questions:
    1. I want to set BarWidth.
      In order to set a width for the bars in a BarSeries you can define a PointTemplate with a Border in it and set its MaxWidth. Here is an example in code:
              <Border Background="#5AA4D4" MaxWidth="20"></Border>
      However, keep in mind that the chart will calculate equal width for each category slot. Then for each category, part of this width will be given and distributed between the bars in the category. When you have fixed size for your bars and the chart is wide enough, the bars will be rendered with the defined size. Otherwise (if the bars cannot fit in the category slot) they will be resized.
      Basically if the total width of the bars in a category slot is bigger than the size allocated for rendering bars the width property from your DataTemplate will be ignored and those bars will be resized in order to fit in the category.
    2. I want to set Color of BarSeries PointSeries.
      To set a color for those types of series you can define DefaultVisualStyle for the series.
          <Style TargetType="Path">
              <Setter Property="Fill" Value="Red" />
          <Style TargetType="Border">
              <Setter Property="Background" Value="Red" />
      In your case you can set the Background of the bars in the PointTemplate instead of creating new visual style for the BarSeries.

    You can also take a look at the Customizing CartesianChart Series help article.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top