4

I'm using Carlos Aguilera's WebChart control and would like to change the legend markers to match the line markers that I am using on the line. I've got the following chart:

image generated from webchart

Here is my code for the legend:

  objLegend = New WebChart.ChartLegend
  objLegend.Font = New Font("Verdana", 8)
  objLegend.Width = 150
  objLegend.Position = LegendPosition.Right
  objLegend.Background.Color = Color.LightYellow
  objLegend.Background.Type = InteriorType.Solid
  objLegend.Background.WrapMode = Drawing2D.WrapMode.Tile

  objEngine.Legend = objLegend

And the code for setting up the Line Markers

 Select Case intColorIndex Mod 5

        Case 0
             objLineChart.LineMarker = New CircleLineMarker(6, Color.Red, Color.Black)

        Case 1
             objLineChart.LineMarker = New DiamondLineMarker(6, Color.Red, Color.Black)
        Case 2
             objLineChart.LineMarker = New SquareLineMarker(6, Color.Red, Color.Black)
        Case 3
             objLineChart.LineMarker = New TriangleLineMarker(6, Color.Red, Color.Black)
        Case 4
             objLineChart.LineMarker = New XLineMarker(6, Color.Red, Color.Black)

      End Select

Neither of these places seem to have a property to set the Legend marker type, and there does not seem to be an option in the ChartEngine object either.

The Legend text is set per line, but the only accessible property from LineChart is the text, there does not seem to be an option for a symbol.

Is it possible to change the legend marker using this control? If so how do I do so?

wax eagle
  • 541
  • 11
  • 27
  • A tutorial and example on his site that might be helpful. 1. http://www.carlosag.net/tools/webchart/image-line-marker 2. http://www.carlosag.net/tools/webchart/sample-column-chart – JSuar Feb 26 '13 at 15:00
  • @JSuar I appreciate the links, but neither cover what this question is asking about. This is specifically not about the line marker (I understand how to change that), this is about the legend symbol (which does not change when you change the line marker). – wax eagle Feb 26 '13 at 15:45
  • On http://www.carlosag.net/tools/webchart/sample-pie-chart the legend symbols appear to be defined in markup: check out the `` element inside ``. Is that closer to what you're looking for? – twip Aug 16 '13 at 16:25
  • @twip yes it does. Feel free to answer with that and I'll accept. – wax eagle Aug 16 '13 at 16:31

1 Answers1

2

On http://www.carlosag.net/tools/webchart/sample-pie-chart the legend symbols look like they're set in markup:

<web:chartcontrol> 
    ...
    <legend width="110" font="Tahoma, 6.75pt">
        <border endcap="Flat" dashstyle="Solid" 
            startcap="Flat" color="Black" width="1" 
            linejoin="Miter"></border>
        <background type="Solid" startpoint="0, 0" 
            forecolor="Black" endpoint="0, 100" color="White"
            hatchstyle="Horizontal"></background>
    </legend>
</web:chartcontrol>

You can try setting your legend symbols by manipulating the <legend> element inside <web:chartcontrol>.

twip
  • 638
  • 2
  • 9
  • 20