Choosing data points marks style

Marks are symbols displayed at the position of line series data points, including OHLC/HLC line series and XY line series. There are 9 different styles of symbols available, as listed below:

SymbolConstant used to specify symbol
Solid squareGraphSerie.SOLID_SQUARE_MARK
Empty squareGraphSerie.EMPTY_SQUARE_MARK
Solid triangleGraphSerie.SOLID_TRIANGLE_MARK
Empty triangleGraphSerie.EMPTY_TRIANGLE_MARK
Solid diamondGraphSerie.SOLID_DIAMOND_MARK
Empty diamondGraphSerie.EMPTY_DIAMOND_MARK
Solid circleGraphSerie.SOLID_CIRCLE_MARK
Empty circleGraphSerie.EMPTY_CIRCLE_MARK
X letterGraphSerie.X_MARK

These constants are also implemented in XYLineSerie, so when specifying marks style of an xy line series replace the constant class name by XYLineSerie.

The default style is a solid square mark. Data points marks are enabled by default. The following table lists the methods to be used to enable/disable marks and change their style.

Class Method Usage
LineSerieGraphSerie.setMarksEnabled(boolean isMarksEnabled) Enable/disable data points marks
OHLCLineSerieGraphSerie.setMarksEnabled(boolean isMarksEnabled) Enable/disable data points marks
XYLineSerieXYLineSerie.setMarksEnabled(boolean isMarksEnabled) Enable/disable data points marks
LineSerieGraphSerie.setMarksStyle(int marksStyle) Specifies marks style
OHLCLineSerieGraphSerie.setMarksStyle(int marksStyle) Specifies marks style
XYLineSerieXYLineSerie.setMarksStyle(int marksStyle) Specifies marks style

To specify marks style use one of the constants listed in the first table above.

The example below displays two line series with respective marks style set to a solid triangle and a solid diamond.

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 data points' marks style"};
        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);

        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);

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

        setSize(400,300);

        setVisible(true);


  }

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

}