Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To add a a lable inside each item set the <code>setBaseItemLabelGenerator</code> in this case I'm using a <code>IntervalCategoryItemLabelGenerator</code> but you can implement you own by extending <code>CategoryItemLabelGenerator</code>.</p> <p>Use this code:</p> <pre><code>CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); renderer.setBaseItemLabelGenerator( new IntervalCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelPaint(Color.BLACK); renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition( ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); </code></pre> <p>You shold then get this: b</p> <p><img src="https://i.stack.imgur.com/NyrHY.jpg" alt="Ganttt Chart with BaseItemLabelGenerator"></p> <p>To customise the lables implement <code>CategoryItemLabelGenerator</code></p> <pre><code>renderer.setBaseItemLabelGenerator( new CategoryItemLabelGenerator(){ @Override public String generateRowLabel(CategoryDataset dataset, int row) { return "Your Row Text " + row; } @Override public String generateColumnLabel(CategoryDataset dataset, int column) { return "Your Column Text " + column; } @Override public String generateLabel(CategoryDataset dataset, int row, int column) { return "Your Label Text " + row + "," + column; } }); </code></pre> <p>In this example <code>generateLabel</code> controls the lable in the bar, <code>CategoryDataset</code>, <code>row</code> and <code>column</code> can be used to determine which bar you are labelling</p> <p><img src="https://i.stack.imgur.com/O8I1p.jpg" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload