Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to rotate group labels when using a GroupedStackedBarRenderer in JFreeChart?
    primarykey
    data
    text
    <p><br/> I have a followed the demo from JFreeChart (<a href="http://read.pudn.com/downloads92/sourcecode/graph/359672/JFreeChart/src/com/rjsoft/barcharts/categoryplot/StackedBarChartDemo5.java__.htm" rel="nofollow noreferrer">StackedBarChartDemo5</a>) in order to create a plot allowing me to use the <code>GroupedStackedBarRenderer</code>.</p> <p>Basically, I'm plotting air times for each station (represents a stack in a bar), connected to a radio (represents a bar in the plot), for both receive and transmit (RX and TX). <br/> The plot looks something like this : <img src="https://i.stack.imgur.com/taXz8.png" alt="enter image description here"></p> <p>There are two categories (RX and TX) and several groups (radios). As you can see, currently, the radio MACs are unreadable. I would like to rotate these labels, in order to make the plot legible. <br/> I have used the following piece of code in order to try and rotate the labels: <code>subCategoryAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4));</code><br/> This only rotated the labels of the categories (RX and TX) instead of the labels of the groups (radio MACs): <img src="https://i.stack.imgur.com/n3YZL.png" alt="enter image description here"></p> <p>I have also tried several other approaches, all of which lead to nowhere... How do I rotate these sublabels?</p> <p>Here is the underlying code that I used to populate the labels with : <br/></p> <pre><code>SubCategoryAxis subCategoryAxis = new SubCategoryAxis("Radio MACs (separate Rx and Tx plots)"); subCategoryAxis.setCategoryMargin(0.05D); // subCategoryAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 4)); KeyToGroupMap keyToGroupMap = null; final Set&lt;String&gt; radios = Sets.newHashSet(); for (Entry&lt;XRadio, Triplet&lt;XStation, Double, Double&gt;&gt; entryMap: channelTimes.entries()) { final String radioMac = entryMap.getKey().getMac(); if (keyToGroupMap == null) keyToGroupMap = new KeyToGroupMap(radioMac); if (!radios.contains(radioMac)) { subCategoryAxis.addSubCategory(radioMac); radios.add(radioMac); } final Triplet&lt;XStation, Double, Double&gt; chTriplet = entryMap.getValue(); final String seriesKey = radioMac + ":" + chTriplet.a.getMac(); keyToGroupMap.mapKeyToGroup(seriesKey, radioMac); model.getDataset().addValue(chTriplet.b, seriesKey, "Rx"); model.getDataset().addValue(chTriplet.c, seriesKey, "Tx"); } if (keyToGroupMap == null) return; groupedStackedBarRenderer.setSeriesToGroupMap(keyToGroupMap); groupedStackedBarRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); groupedStackedBarRenderer.setBaseItemLabelsVisible(true); groupedStackedBarRenderer.setItemMargin(0.1D); // 10 % groupedStackedBarRenderer.getPlot().setDomainAxis(subCategoryAxis); </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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