Question

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?

Was it helpful?

Solution

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>.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top