I have noticed some strange behavior when I try to save a chart as an image. The x and y axis show up with labels and the correct range but there are no bars.
The above code is what I used to produce this. I am using version 2012.2.726.40.
I discovered that if I give the chart a palette, this issue goes away.
Private Function GetDummyList() As BindingList(Of RateShockData)
Dim l As New BindingList(Of RateShockData)
l.Add(New RateShockData("+300", "-13.9"))
l.Add(New RateShockData("+200", "-9"))
l.Add(New RateShockData("+100", "-3.9"))
l.Add(New RateShockData("even", "0"))
l.Add(New RateShockData("-100", "-.2"))
l.Add(New RateShockData("-200", "1"))
l.Add(New RateShockData("-300", "2.2"))
Return l
End Function
Private Function BuildChart()
Dim c1 As New RadChartView
Dim bs As New BarSeries
bs.Name = "Market % Change"
bs.ValueMember = "MVPctChange"
bs.CategoryMember = "BPChange"
bs.DataSource = GetDummyList()
c1.Series.Clear()
c1.Series.Add(bs)
Dim bitM As New Bitmap(c1.Width, c1.Height)
c1.DrawToBitmap(bitM, c1.Bounds)
Dim imageFileName As String = Guid.NewGuid.ToString + ".jpg"
bitM.Save(imageFileName, Drawing.Imaging.ImageFormat.Jpeg)
End Function
Private Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click
BuildChart()
End Sub
Public Class RateShockData
Property BPChange As String
Property MVPctChange As String
Public Sub New(bpc As String, mvpc As String)
BPChange = bpc
MVPctChange = mvpc
End Sub
End Class
The above code is what I used to produce this. I am using version 2012.2.726.40.
I discovered that if I give the chart a palette, this issue goes away.
c1.Area.View.Palette = KnownPalette.Grayscale