Go to the documentation of this file.
19package org.sleuthkit.autopsy.datasourcesummary.uiutils;
21import java.awt.BorderLayout;
24import javax.swing.JLabel;
25import org.apache.commons.collections4.CollectionUtils;
26import org.jfree.chart.ChartFactory;
27import org.jfree.chart.ChartPanel;
28import org.jfree.chart.JFreeChart;
29import org.jfree.chart.axis.ValueAxis;
30import org.jfree.chart.plot.CategoryPlot;
31import org.jfree.chart.plot.PlotOrientation;
32import org.jfree.chart.renderer.category.BarRenderer;
33import org.jfree.chart.renderer.category.StandardBarPainter;
34import org.jfree.data.category.DefaultCategoryDataset;
35import org.sleuthkit.autopsy.datasourcesummary.uiutils.BarChartSeries.BarChartItem;
47 private final ChartMessageOverlay
overlay =
new ChartMessageOverlay();
48 private final DefaultCategoryDataset
dataset =
new DefaultCategoryDataset();
50 private final CategoryPlot
plot;
56 this(
null,
null,
null);
66 public BarChartPanel(String title, String categoryLabel, String valueLabel) {
67 this.chart = ChartFactory.createStackedBarChart(
72 PlotOrientation.VERTICAL,
76 chart.setBackgroundPaint(
null);
79 this.plot = ((CategoryPlot)
chart.getPlot());
80 this.plot.getRenderer().setDefaultItemLabelFont(
DEFAULT_FONT);
81 plot.setBackgroundPaint(
null);
82 plot.setOutlinePaint(
null);
85 ValueAxis range =
plot.getRangeAxis();
86 range.setVisible(
false);
89 plot.getDomainAxis().setMaximumCategoryLabelWidthRatio(10);
91 ((BarRenderer)
plot.getRenderer()).setBarPainter(
new StandardBarPainter());
94 ChartPanel panel =
new ChartPanel(
chart);
96 panel.setPopupMenu(
null);
98 this.setLayout(
new BorderLayout());
99 this.add(panel, BorderLayout.CENTER);
106 return (this.chart ==
null || this.chart.getTitle() ==
null)
108 : this.chart.getTitle().getText();
119 this.chart.
getTitle().setText(title);
125 this.overlay.setVisible(visible);
126 this.overlay.setMessage(message);
131 this.dataset.clear();
133 if (CollectionUtils.isNotEmpty(data)) {
134 for (
int s = 0; s < data.size(); s++) {
136 if (series !=
null && CollectionUtils.isNotEmpty(series.
getItems())) {
138 this.plot.getRenderer().setSeriesPaint(s, series.
getColor());
141 for (
int i = 0; i < series.
getItems().size(); i++) {
BarChartPanel setTitle(String title)
static final long serialVersionUID
void setMessage(boolean visible, String message)
final ChartMessageOverlay overlay
void setResults(List< BarChartSeries > data)
final DefaultCategoryDataset dataset
static final Font DEFAULT_HEADER_FONT
static final Font DEFAULT_FONT
BarChartPanel(String title, String categoryLabel, String valueLabel)
List< BarChartItem > getItems()
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.