Hi,
Picture exported in wrong size to picture.image when creating RadChartView in AchiverReports10. Picture is cropped when adding Legend Title. Could you help me please in this question?
Private Sub GroupFooter1_Format(sender As Object, e As EventArgs) Handles GroupFooter1.Format
Dim rchv As New RadChartView
rchv.Name = "rchv"
rchv.ShowTitle = True
rchv.Title = "Test"
rchv.ChartElement.TitleElement.Font = New Font("Arial", 16)
rchv.ShowToolTip = True
rchv.ShowLegend = False
rchv.Area.View.Palette = KnownPalette.Metro
AddHandler rchv.LabelFormatting, AddressOf rcvQualityPie_LabelFormatting
rchv.Series.Clear()
rchv.AreaType = ChartAreaType.Pie
rchv.ChartElement.AutoSize = True
rchv.ShowSmartLabels = True
rchv.ShowLegend = False
Dim series As New PieSeries()
For Each row As DataRow In _dtRejctResons.Rows
series.DataPoints.Add(New Telerik.Charting.PieDataPoint(row("OsuusPerc"), row("RaakkiSelite")))
Next
series.DrawLinesToLabels = True
series.SyncLinesToLabelsColor = True
series.ShowLabels = True
rchv.Series.Add(series)
Dim sFileName As String = "exprtedChart1.png"
Dim sFilePath As String
sFilePath = System.IO.Path.GetTempPath & sFileName
If File.Exists(sFilePath) = True Then
File.Delete(sFilePath)
End If
rchv.ExportToImage(sFilePath, rchv.Size, System.Drawing.Imaging.ImageFormat.Png)
Picture.Image = Image.FromFile(sFilePath)
End Sub
Private Sub rcvQualityPie_LabelFormatting(sender As Object, e As ChartViewLabelFormattingEventArgs)
Dim pieElement As PiePointElement = DirectCast(e.LabelElement.Parent, PiePointElement)
Dim dataPoint As PieDataPoint = DirectCast(pieElement.DataPoint, PieDataPoint)
e.LabelElement.BackColor = Color.White
e.LabelElement.BorderColor = Color.White
e.LabelElement.Text = String.Format("{0}, " & "{1} %", dataPoint.LegendTitle, Math.Round(dataPoint.Percent, 0))
e.LabelElement.Padding = New System.Windows.Forms.Padding(6, 0, -100, 0)
End Sub