HashMap<Integer, ArrayList<ResidueAnnotation>> proteinAnnotations,
boolean addReferenceLine, boolean allowZooming) {
this.proteinSequencePanelParent = aProteinSequencePanelParent;
DefaultCategoryDataset barChartDataset = new DefaultCategoryDataset();
StackedBarRenderer renderer = new StackedBarRenderer();
renderer.setShadowVisible(false);
CategoryToolTipGenerator myTooltips = new ProteinAnnotations(proteinAnnotations);
// add the data
for (int i = 0; i < sparklineDataset.getData().size(); i++) {
JSparklinesDataSeries sparklineDataSeries = sparklineDataset.getData().get(i);
for (int j = 0; j < sparklineDataSeries.getData().size(); j++) {
barChartDataset.addValue(sparklineDataSeries.getData().get(j), "" + i, "" + j);
renderer.setSeriesPaint(i, sparklineDataSeries.getSeriesColor());
renderer.setSeriesToolTipGenerator(i, myTooltips);
}
}
// create the chart
JFreeChart chart = ChartFactory.createStackedBarChart(null, null, null, barChartDataset, PlotOrientation.HORIZONTAL, false, false, false);
// fine tune the chart properites
CategoryPlot plot = chart.getCategoryPlot();
// remove space before/after the domain axis
plot.getDomainAxis().setUpperMargin(0);
plot.getDomainAxis().setLowerMargin(0);
// remove space before/after the range axis
plot.getRangeAxis().setUpperMargin(0);
plot.getRangeAxis().setLowerMargin(0);
renderer.setRenderAsPercentages(true);
renderer.setBaseToolTipGenerator(new IntervalCategoryToolTipGenerator());
// add the dataset to the plot
plot.setDataset(barChartDataset);
// hide unwanted chart details