Setting the legend position of bar series data points.

As the previous topic illustrates, data points legends are displayed next to the top of a bar series bars. However, in certain conditions, as a narrow chart or a bar series with a large number of values, data points legends may overlap each other, and the solution is to display the legends inside the bars.
The method BarSerie.setMarkLegendPosition(int markLegendPosition) can be used to place legends inside the bars, horizontally or vertically oriented. This method can be passed three constants:

Depending on the dimension of a bar, a legend vertically arranged may not fit inside, extending beyond the top. The method BarSerie.setMarkLegendRoomCheckEnabled(boolean isMarkLegendRoomCheckEnabled) can be used to toggle verification of available space inside a bar. If set to true, should a legend does not fit inside a bar it is not displayed.
Room checking is not enabled by default.
Stacked bar series, represented by class com.jinsight.jetchart.StackBarSerie, also support the methods above, since they inherit the properties of bar series.

The following example displays two bar series, one with data points legends displayed horizontally inside the bars and the other displaying vertical legends.

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","Setting the legend position of bar series data points"};
        graph.setTitle(title);
       
        Container ct=getContentPane();

        ct.add("Center",graph);

        BarSerie bs1=new BarSerie();
        bs1.setTitle("Bar series 1");
        bs1.setColor(Color.yellow);
        bs1.setWidth(45);
        double[] values1={100,130,90,110};
        bs1.setValues(values1);
        
        bs1.setMarkLegendEnabled(true);
        bs1.setMarkLegendPosition(BarSerie.INSIDE);
        bs1.setMarkLegendRoomCheckEnabled(true);
        bs1.setValueFormat("$ ###,###");

        BarSerie bs2=new BarSerie();
        bs2.setTitle("Bar series 2");
        bs2.setColor(Color.cyan);
        bs2.setWidth(15);
        double[] values2={50,70,55,70};
        bs2.setValues(values2);
        
        bs2.setMarkLegendEnabled(true);
        bs2.setMarkLegendPosition(BarSerie.INSIDE_VERTICAL);
        bs2.setMarkLegendRoomCheckEnabled(true);
        bs2.setValueFormat("$ ###,###");

        graph.addSerie(bs1);
        graph.addSerie(bs2);

        setSize(500,400);

        setVisible(true);

  }

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

}