use of org.talend.dataprofiler.chart.TalendBarRenderer in project tdq-studio-se by Talend.
the class TopChartFactory method createMatchRuleBarChart.
/**
* DOC zshen Comment method "createMatchRuleBarChart".
*
* @param title
* @param dataset
* @return
*/
public static JFreeChart createMatchRuleBarChart(String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) {
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart localJFreeChart = ChartFactory.createBarChart(null, categoryAxisLabel, valueAxisLabel, dataset, PlotOrientation.VERTICAL, false, true, false);
localJFreeChart.addSubtitle(new TextTitle(Messages.getString("DataChart.title", sumItemCount(dataset), // $NON-NLS-1$
sumGroupCount(dataset))));
CategoryPlot plot = (CategoryPlot) localJFreeChart.getPlot();
// get real color list from ChartDecorator.COLOR_LIST dataset.getColumnKeys()
List<Color> currentColorList = null;
try {
currentColorList = getCurrentColorList(dataset.getColumnKeys());
} catch (NumberFormatException e) {
log.warn(e, e);
currentColorList = ChartDecorator.COLOR_LIST;
}
BarRenderer barRenderer = new TalendBarRenderer(true, currentColorList);
barRenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
barRenderer.setBaseItemLabelsVisible(true);
// remove the shadow
barRenderer.setShadowVisible(Boolean.FALSE);
plot.setRenderer(barRenderer);
CategoryAxis localCategoryAxis = plot.getDomainAxis();
localCategoryAxis.setCategoryMargin(0.25D);
localCategoryAxis.setUpperMargin(0.02D);
localCategoryAxis.setLowerMargin(0.02D);
NumberAxis localNumberAxis = (NumberAxis) plot.getRangeAxis();
localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
localNumberAxis.setUpperMargin(0.1D);
return localJFreeChart;
}
use of org.talend.dataprofiler.chart.TalendBarRenderer in project tdq-studio-se by Talend.
the class TopChartFactory method createBarChart.
/**
* mzhao create bar chart with default bar render class.
*
* @param titile
* @param dataset
* @param showLegend
* @return
*/
public static JFreeChart createBarChart(String titile, CategoryDataset dataset, boolean showLegend) {
// MOD hcheng for 6965,Use 2D bar charts instead of 3D bar charts
// ADD msjian TDQ-5112 2012-4-10: after upgrate to jfreechart-1.0.12.jar, change the default chart wallPaint
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
// TDQ-5112~
JFreeChart chart = ChartFactory.createBarChart(null, titile, // $NON-NLS-1$
Messages.getString("TopChartFactory.count"), // $NON-NLS-1$
dataset, // $NON-NLS-1$
PlotOrientation.VERTICAL, // $NON-NLS-1$
showLegend, true, false);
ChartDecorator.decorateBarChart(chart, new TalendBarRenderer(true, ChartDecorator.COLOR_LIST));
return chart;
}
use of org.talend.dataprofiler.chart.TalendBarRenderer in project tdq-studio-se by Talend.
the class TopChartFactory method createBarChartByKCD.
/**
* create bar chart.
*
* @param titile
* @param dataset
* @return
*/
public static JFreeChart createBarChartByKCD(String title, CategoryDataset dataset, Object cusmomerDataset) {
// ADD msjian TDQ-5112 2012-4-10: after upgrate to jfreechart-1.0.12.jar, change the default chart wallPaint
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
// TDQ-5112~
JFreeChart createBarChart = ChartFactory.createBarChart(null, Messages.getString("TopChartFactory.Value"), title, dataset, PlotOrientation.HORIZONTAL, false, false, // $NON-NLS-1$
false);
CategoryPlot plot = createBarChart.getCategoryPlot();
if (cusmomerDataset != null) {
plot.setDataset(1, new EncapsulationCumstomerDataset(dataset, cusmomerDataset));
}
CategoryAxis domainAxis = plot.getDomainAxis();
domainAxis.setTickLabelPaint(NULL_FIELD, Color.RED);
domainAxis.setTickLabelPaint(NULL_FIELD2, Color.RED);
domainAxis.setTickLabelPaint(EMPTY_FIELD, Color.RED);
// ADD TDQ-5251 msjian 2012-7-31: do not display the shadow
BarRenderer renderer = new TalendBarRenderer(false, ChartDecorator.COLOR_LIST);
renderer.setShadowVisible(false);
// TDQ-5251~
plot.setRenderer(renderer);
return createBarChart;
}
Aggregations