Displaying Symbols On Legend
Posted: Thu Jan 17, 2013 8:16 am
I am having trouble displaying chart symbols in the chart legend of of one of my apps. The symbols (pointer styles) will not display in the legend, although the colors are correct.
Legend Code
Points1.Chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Right
Points1.Chart.Legend.Transparent = False
Points1.Chart.Legend.Transparency = 0
Points1.Chart.Legend.Height = 200
Points1.Chart.Legend.Width = 130
Points1.Chart.Legend.AutoSize = False
Points1.Chart.Legend.ResizeChart = False
Points1.Chart.Legend.Visible = True
Points1.Chart.Legend.Title.Font.Name = "Arial"
Points1.Chart.Legend.Title.Font.Size = 12
Points1.Chart.Legend.Title.Text = "Legend"
Points1.Chart.Legend.Title.Visible = True
LegendScrollBar1.DrawStyle = Steema.TeeChart.Tools.ScrollBarDrawStyle.WhenNeeded
Points1.Chart.Legend.CustomPosition = False
Points1.Chart.Legend.TopLeftPos = 1
I use GetPointerStyle to set the chart symbols
Sub Points1_GetPointerStyle(ByVal series As Object, ByVal e As Steema.TeeChart.Styles.GetPointerStyleEventArgs)
If Symbol2(e.ValueIndex) = 33 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle
If Symbol2(e.ValueIndex) = 34 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Circle
If Symbol2(e.ValueIndex) = 35 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Triangle
If Symbol2(e.ValueIndex) = 36 Then e.Style = Steema.TeeChart.Styles.PointerStyles.DownTriangle
If Symbol2(e.ValueIndex) = 37 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Cross
If Symbol2(e.ValueIndex) = 38 Then e.Style = Steema.TeeChart.Styles.PointerStyles.DiagCross
If Symbol2(e.ValueIndex) = 39 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Star
If Symbol2(e.ValueIndex) = 40 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Diamond
If Symbol2(e.ValueIndex) = 41 Then e.Style = Steema.TeeChart.Styles.PointerStyles.LeftTriangle
If Symbol2(e.ValueIndex) = 42 Then e.Style = Steema.TeeChart.Styles.PointerStyles.RightTriangle
If Symbol2(e.ValueIndex) = 43 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Hexagon
If Symbol2(e.ValueIndex) = 44 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Nothing
Exit Sub
Error1:
Exit Sub
End Sub
Legend Code
Points1.Chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Right
Points1.Chart.Legend.Transparent = False
Points1.Chart.Legend.Transparency = 0
Points1.Chart.Legend.Height = 200
Points1.Chart.Legend.Width = 130
Points1.Chart.Legend.AutoSize = False
Points1.Chart.Legend.ResizeChart = False
Points1.Chart.Legend.Visible = True
Points1.Chart.Legend.Title.Font.Name = "Arial"
Points1.Chart.Legend.Title.Font.Size = 12
Points1.Chart.Legend.Title.Text = "Legend"
Points1.Chart.Legend.Title.Visible = True
LegendScrollBar1.DrawStyle = Steema.TeeChart.Tools.ScrollBarDrawStyle.WhenNeeded
Points1.Chart.Legend.CustomPosition = False
Points1.Chart.Legend.TopLeftPos = 1
I use GetPointerStyle to set the chart symbols
Sub Points1_GetPointerStyle(ByVal series As Object, ByVal e As Steema.TeeChart.Styles.GetPointerStyleEventArgs)
If Symbol2(e.ValueIndex) = 33 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Rectangle
If Symbol2(e.ValueIndex) = 34 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Circle
If Symbol2(e.ValueIndex) = 35 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Triangle
If Symbol2(e.ValueIndex) = 36 Then e.Style = Steema.TeeChart.Styles.PointerStyles.DownTriangle
If Symbol2(e.ValueIndex) = 37 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Cross
If Symbol2(e.ValueIndex) = 38 Then e.Style = Steema.TeeChart.Styles.PointerStyles.DiagCross
If Symbol2(e.ValueIndex) = 39 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Star
If Symbol2(e.ValueIndex) = 40 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Diamond
If Symbol2(e.ValueIndex) = 41 Then e.Style = Steema.TeeChart.Styles.PointerStyles.LeftTriangle
If Symbol2(e.ValueIndex) = 42 Then e.Style = Steema.TeeChart.Styles.PointerStyles.RightTriangle
If Symbol2(e.ValueIndex) = 43 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Hexagon
If Symbol2(e.ValueIndex) = 44 Then e.Style = Steema.TeeChart.Styles.PointerStyles.Nothing
Exit Sub
Error1:
Exit Sub
End Sub