Choosing the style of a line series legend

Series are represented in the legend box by a solid square by default, painted in the same color of respective series. Line series, including OHLC/HLC line series and XY line series, can have their legend symbols changed to match the shape of respective data points marks, in which case the symbols are painted in the same color of the marks and a horizontal line is displayed, cutting the legend symbol and painted in the same color of respective series. The symbol line also matches the series style, solid or dashed(only line series and OHLC/HLC line series. XY line series are always solid).

The method setLegendStyle(int legendStyle) is implemented by classes LineSerie, OHLCLineSerie and XYLineSerie. This method can receive two values, SOLID_SQUARE_LEGEND and MARK_SHAPE_LEGEND. The former is used to change the legend symbol back to the default shape, a solid square, and the latter changes the symbol to match the shape of data points marks, also displaying a crossing horizontal line.

The example below is the same of the previous topic, only two new lines are added to change the style of the legend symbols.

import javax.swing.*;
import java.awt.*;
import com.jinsight.jetchart.*;

public class Main extends JFrame {

   public Main() { 

        Graph graph=new Graph();
	String[] labels={"label1","label2","label3","label4"};
	graph.setLabels(labels);
		
	GraphSet graphSet=graph.getGraphSet(0);

	Grid grid=graphSet.getGrid();

	grid.setEnabled(true);
	grid.setColor(Color.gray);

        String[] title={"The JetChart Library","Choosing the style of a line series' legend"};
        graph.setTitle(title);
       
        Container ct=getContentPane();

        ct.add("Center",graph);

        LineSerie ls1=new LineSerie();
        ls1.setTitle("Line series 1");
        ls1.setColor(Color.red);
        double[] values1={100,80,90,110};
        ls1.setValues(values1);
        ls1.setMarksStyle(GraphSerie.SOLID_TRIANGLE_MARK);
        ls1.setMarksColor(Color.gray);
	
	ls1.setLegendStyle(GraphSerie.MARK_SHAPE_LEGEND);

        LineSerie ls2=new LineSerie();
        ls2.setTitle("Line series 2");
        ls2.setColor(Color.blue);
        double[] values2={50,70,55,130};
        ls2.setValues(values2);
        ls2.setMarksStyle(GraphSerie.SOLID_DIAMOND_MARK);
        ls2.setMarksColor(Color.magenta);
        
	ls2.setLegendStyle(GraphSerie.MARK_SHAPE_LEGEND);

        graph.addSerie(ls1);
        graph.addSerie(ls2);

        setSize(400,300);

        setVisible(true);


  }

  public static void main(String[] args) {
        new Main();
  }

}