Styling Chartview

9 posts, 0 answers
  1. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 24 Apr 2012 Link to this post

    Hi there,

    How would you style the slices on a PieChart programatically?

    assume this code...
    Dim radPieChart1 As New RadPieChart()
    Dim series As New PieSeries()
     
    series.DataPoints.Add(New PieDataPoint() With {.Value = 100})
    series.DataPoints.Add(New PieDataPoint() With {.Value = 35})
    series.DataPoints.Add(New PieDataPoint() With {.Value = 15, .OffsetFromCenter = 0.3, .IsSelected = True})
     
     
    radPieChart1.Series.Add(series)
     
    LayoutQ4.Children.Add(radPieChart1)

    I would like to have say... slice 1 blue, slice 2 yellow, slice 3 red...


    Thanks and best regards,
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 27 Apr 2012 Link to this post

    Hello Gonzalo,

    You can use the SliceStyles property of the pie series. The index of the style in the SliceStyles corresponds to the index of the data point in the DataPoints collection.

    The slice style needs to target a Path, and probably the property that you most need is Fill.

    I hope this helps.

    Kind regards,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 27 Apr 2012 Link to this post

    Obrigado! Gracias! Thank you very much for your prompt response.

    Would you be so kind to provide and example supporting PieSeries and Barseries?

    Thanks for all your support,

    G
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 27 Apr 2012 Link to this post

    Hello Gonzalo,

    I have attached a simple app that demonstrates how to use the previously suggested approach. The app consists of a button and a chart view. A slice (and a style) should be added for every click of the button.  

    All the best,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 27 Apr 2012 Link to this post

    Thanks Petar! I will check this :)
  7. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 27 Apr 2012 Link to this post

    Hi Petar,

    Thanks so much for the code! How would you code a BarSeries. In xaml is simple but I am trying to do it in code.

    Thanks! Have a great weekend!

    G

    PS. If there is a repository of sample in regards to ChartView I would appreciate you refer me to it.
  8. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 01 May 2012 Link to this post

    Hello Gonzalo,

    For the bar series you can use the Palette property of the chart view.

    If you have installed our controls you should have the WPF examples under your Program Files/Telerik folder. In the upper right corner you can click on the Code tab and see the code for the current demo. (or click here)

    You can also check our Silverlight online examples here (the same code should be applicable for WPF).

    And you can explore our online help here

    Greetings,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Gonzalo
    Gonzalo avatar
    76 posts
    Member since:
    Oct 2012

    Posted 01 May 2012 Link to this post

    Greetings,

    I have this code from radchart, I would love to move it to radchartview

    The xaml looks like this

    <telerik:RadChart Grid.Column="1" Grid.Row="1" x:Name="RadChart1" Margin="23,180,28,0" />
    The code  behind is :

            RadChart1.DefaultView.ChartTitle.Content = "Current Online SVL Providers"
            RadChart1.DefaultView.ChartLegend.Header = "Legend"
            RadChart1.DefaultView.ChartLegend.UseAutoGeneratedItems = True
     
            'Axis X
            RadChart1.DefaultView.ChartArea.AxisX.Title = "Type"
            RadChart1.DefaultView.ChartArea.AxisX.AutoRange = False
            RadChart1.DefaultView.ChartArea.AxisX.MinValue = 1
            RadChart1.DefaultView.ChartArea.AxisX.MaxValue = 5
            RadChart1.DefaultView.ChartArea.AxisX.[Step] = 1
            RadChart1.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Between
             
    'Axis Y
            RadChart1.DefaultView.ChartArea.AxisY.Title = "Provider"
            Dim series As New DataSeries()
            series.Definition = New BarSeriesDefinition()
            series.Definition.Appearance.Fill = New SolidColorBrush(Color.FromArgb(255, 87, 179, 233))
            series.LegendLabel = "Number of Providers"
            For row As Integer = 0 To xValues.Count - 1
                series.Add(New DataPoint(xValues(row), yvalues(row)))
            Next
     
            RadChart1.DefaultView.ChartArea.DataSeries.Add(series)
    How can I change it as Radchartview does not seem to support DataSeries and I did not see BarSeries  available?

    Best regards,

    G

    PS. Version 2012.1.416.40
  10. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 02 May 2012 Link to this post

    Hello Gonzalo,

    I will again direct you to our online demos and help. I strongly suggest that you invest time in exploring the control to get you familiar with the control's features, possibilities, limitations and how-to's. You can see how to work with BarSeries in the very first example.

    Note that the RadChart and RadChartView are two different controls and they do not have an equivalent for each feature. They are also set-up in a different way. So translating code from one control to the other line-by-line is not the best solution.

    Here you can read about some of the differences.

    I again encourage you to get to know the control before you start developing your project.

    Greetings,
    Petar Marchev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
UI for WPF is Visual Studio 2017 Ready