Unplanned
Last Updated: 06 Feb 2017 10:44 by ADMIN
ADMIN
Hristo
Created on: 02 Dec 2016 09:44
Category: ChartView
Type: Bug Report
1
FIX. RadChartView - the rectangle holding the legends should be scaled according to the provided size if you export the chart to an image
How to reproduce: 
Public Class Form1

    Sub New()

        InitializeComponent()

        Dim barSeries As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries.Name = "Q1"
        barSeries.LegendTitle = "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "Leg

        barSeries.DataPoints.Add(New CategoricalDataPoint(177, "Harley"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(128, "White"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(143, "Smith"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(111, "Jones"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(118, "Marshall"))

        Me.RadChartView1.Series.Add(barSeries)
        Dim barSeries2 As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries2.Name = "Q2"
        barSeries2.LegendTitle = "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "Le

        barSeries2.DataPoints.Add(New CategoricalDataPoint(153, "Harley"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(141, "White"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(130, "Smith"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(88, "Jones"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(109, "Marshall"))
        Me.RadChartView1.Series.Add(barSeries2)

        Me.RadChartView1.ShowTitle = True
        Me.RadChartView1.ShowLegend = True
        Me.RadChartView1.LegendTitle = "Legend"

        Me.RadChartView1.Size = New Size(500, 150)
        Me.RadChartView1.ShowPanZoom = True

        'Me.SetupLineSeries()

    End Sub

    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        Dim filePath As String = "..\..\exprotedChart2.png"
        Me.RadChartView1.ExportToImage(filePath, New Size(1000, 800), System.Drawing.Imaging.ImageFormat.Png)

    End Sub
End Class

Workaround: increase the size of the chart
Public Class Form1

    Sub New()

        InitializeComponent()

        Dim barSeries As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries.Name = "Q1"
        barSeries.LegendTitle = "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1"

        barSeries.DataPoints.Add(New CategoricalDataPoint(177, "Harley"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(128, "White"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(143, "Smith"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(111, "Jones"))
        barSeries.DataPoints.Add(New CategoricalDataPoint(118, "Marshall"))

        Me.RadChartView1.Series.Add(barSeries)
        Dim barSeries2 As New Telerik.WinControls.UI.BarSeries("Performance", "RepresentativeName")
        barSeries2.Name = "Q2"
        barSeries2.LegendTitle = "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1" + vbCrLf + "LegendTitle1"

        barSeries2.DataPoints.Add(New CategoricalDataPoint(153, "Harley"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(141, "White"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(130, "Smith"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(88, "Jones"))
        barSeries2.DataPoints.Add(New CategoricalDataPoint(109, "Marshall"))
        Me.RadChartView1.Series.Add(barSeries2)

        Me.RadChartView1.ShowTitle = True
        Me.RadChartView1.ShowLegend = True
        Me.RadChartView1.LegendTitle = "Legend"

        Me.RadChartView1.Size = New Size(500, 150)
        Me.RadChartView1.ShowPanZoom = True

        'Me.SetupLineSeries()

    End Sub

    Dim size As Size
    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        AddHandler Me.RadChartView1.SizeChanged, AddressOf RadChartView1_SizeChanged
        size = Me.RadChartView1.Size
        Me.RadChartView1.Size = New Size(1000, 800)

    End Sub

    Private Sub RadChartView1_SizeChanged(sender As Object, e As EventArgs)
        RemoveHandler Me.RadChartView1.SizeChanged, AddressOf RadChartView1_SizeChanged

        Dim filePath As String = "..\..\exprotedChart2.png"
        Me.RadChartView1.ExportToImage(filePath, Me.RadChartView1.Size, System.Drawing.Imaging.ImageFormat.Png)
        Me.RadChartView1.Size = size
    End Sub
End Class
0 comments