List of usage examples for org.jfree.chart.axis CategoryLabelPositions DOWN_90
CategoryLabelPositions DOWN_90
To view the source code for org.jfree.chart.axis CategoryLabelPositions DOWN_90.
Click Source Link
From source file:it.marcoberri.mbmeteo.action.chart.GetMinOrMax.java
/** * * @param request//from www. j ava 2s. com * @param response * @throws ServletException * @throws IOException */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("start : " + this.getClass().getName()); final HashMap<String, String> params = getParams(request.getParameterMap()); final Integer dimy = Default.toInteger(params.get("dimy"), 600); final Integer dimx = Default.toInteger(params.get("dimx"), 800); final String from = Default.toString(params.get("from") + " 00:00:00", "1970-01-01 00:00:00"); final String to = Default.toString(params.get("to") + " 23:59:00", "2030-01-01 23:59:00"); final String field = Default.toString(params.get("field"), "outdoorTemperature"); final String period = Default.toString(params.get("period"), "day"); final String type = Default.toString(params.get("type"), "min"); request.getSession().setAttribute("from", params.get("from")); request.getSession().setAttribute("to", params.get("to")); final String cacheKey = getCacheKey(params); if (cacheReadEnable) { final Query q = ds.find(Cache.class); q.filter("cacheKey", cacheKey).filter("servletName", this.getClass().getName()); final Cache c = (Cache) q.get(); if (c == null) { log.info("cacheKey:" + cacheKey + " on servletName: " + this.getClass().getName() + " not found"); } if (c != null) { final GridFSDBFile imageForOutput = MongoConnectionHelper.getGridFS() .findOne(new ObjectId(c.getGridId())); if (imageForOutput != null) { ds.save(c); try { response.setHeader("Content-Length", "" + imageForOutput.getLength()); response.setHeader("Content-Disposition", "inline; filename=\"" + imageForOutput.getFilename() + "\""); final OutputStream out = response.getOutputStream(); final InputStream in = imageForOutput.getInputStream(); final byte[] content = new byte[(int) imageForOutput.getLength()]; in.read(content); out.write(content); in.close(); out.close(); return; } catch (Exception e) { log.error(e); } } else { log.error("file not in db"); } } } final Query q = ds.createQuery(MapReduceMinMax.class).disableValidation(); final Date dFrom = DateTimeUtil.getDate("yyyy-MM-dd hh:mm:ss", from); final Date dTo = DateTimeUtil.getDate("yyyy-MM-dd hh:mm:ss", to); final String formatIn = getFormatIn(period); final String formatOut = getFormatOut(period); final List<Date> datesIn = getRangeDate(dFrom, dTo); final HashSet<String> datesInString = new HashSet<String>(); for (Date d : datesIn) { datesInString.add(DateTimeUtil.dateFormat(formatIn, d)); } if (datesIn != null && !datesIn.isEmpty()) { q.filter("_id in", datesInString); } q.order("_id"); final List<MapReduceMinMax> mapReduceResult = q.asList(); final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); ChartEnumMinMaxHelper chartEnum = ChartEnumMinMaxHelper.getByFieldAndType(field, type); for (MapReduceMinMax m : mapReduceResult) { try { final Date tmpDate = DateTimeUtil.getDate(formatIn, m.getId().toString()); if (tmpDate == null) { continue; } final Method method = m.getClass().getMethod(chartEnum.getMethod()); final Number n = (Number) method.invoke(m); dataset.addValue(n, chartEnum.getType(), DateTimeUtil.dateFormat(formatOut, tmpDate)); } catch (IllegalAccessException ex) { log.error(ex); } catch (IllegalArgumentException ex) { log.error(ex); } catch (InvocationTargetException ex) { log.error(ex); } catch (NoSuchMethodException ex) { log.error(ex); } catch (SecurityException ex) { log.error(ex); } } final JFreeChart chart = ChartFactory.createBarChart(chartEnum.getTitle(), // chart title "", // domain axis label chartEnum.getUm(), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); final CategoryPlot xyPlot = (CategoryPlot) chart.getPlot(); final CategoryAxis domain = xyPlot.getDomainAxis(); if (field.toUpperCase().indexOf("PRESSURE") != -1) { xyPlot.getRangeAxis().setRange(chartPressureMin, chartPressureMax); } else { xyPlot.getRangeAxis().setAutoRange(true); } domain.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); final File f = File.createTempFile("mbmeteo", ".jpg"); ChartUtilities.saveChartAsJPEG(f, chart, dimx, dimy); try { if (cacheWriteEnable) { final GridFSInputFile gfsFile = MongoConnectionHelper.getGridFS().createFile(f); gfsFile.setFilename(f.getName()); gfsFile.save(); final Cache c = new Cache(); c.setServletName(this.getClass().getName()); c.setCacheKey(cacheKey); c.setGridId(gfsFile.getId().toString()); ds.save(c); } response.setContentType("image/jpeg"); response.setHeader("Content-Length", "" + f.length()); response.setHeader("Content-Disposition", "inline; filename=\"" + f.getName() + "\""); final OutputStream out = response.getOutputStream(); final FileInputStream in = new FileInputStream(f.toString()); final int size = in.available(); final byte[] content = new byte[size]; in.read(content); out.write(content); in.close(); out.close(); } catch (Exception e) { log.error(e); } finally { boolean delete = f.delete(); } }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart.//from www .j a v a2 s. c o m * * @param dataset * @param title * @return */ protected JFreeChart createLineChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createLineChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesStroke(ser, new BasicStroke(4)); StandardCategoryItemLabelGenerator gen = new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN)) { private static final long serialVersionUID = 1L; public String generateLabel(CategoryDataset dataset, int series, int item) { if (item % 3 == 0) { return super.generateLabelString(dataset, series, item); } else { return null; } } }; renderer.setSeriesItemLabelGenerator(ser, gen); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a bar chart.// w w w . j a va2s. c o m * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @return JfreeChart instance. */ public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.01); domainAxis.setUpperMargin(0.01); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); return chart; }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart./*from w w w. j a va 2s. com*/ * * @param dataset * @param title * @return */ protected JFreeChart createBarChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createBarChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesItemLabelGenerator(ser, new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN))); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }
From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java
/** * Creates a line chart.//from w ww .j a v a 2s . co m * * @param title * @param categoryAxisLabel * (X-Axis label) * @param valueAxisLabel * (Y-Axis label) * @param dataset * @param includeZero * True when zero shall be included to the axis range. * @return JfreeChart instance. */ public JFreeChart createLineChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, boolean includeZero, boolean drawShapes) { JFreeChart chart = ChartFactory.createLineChart(title, categoryAxisLabel, valueAxisLabel, dataset, this.orientation, this.drawLegend, false, false); // set the background color for the chart... chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); CategoryPlot plot = chart.getCategoryPlot(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.025); domainAxis.setUpperMargin(0.025); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(includeZero); LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, Color.blue); renderer.setSeriesPaint(1, Color.red); renderer.setSeriesPaint(2, Color.green); renderer.setSeriesPaint(3, Color.darkGray); renderer.setSeriesPaint(4, Color.yellow); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setBaseShapesVisible(drawShapes); renderer.setBaseShapesFilled(true); return chart; }
From source file:RDGraphGenerator.java
/** * Creates a sample chart./* w ww .j a v a 2 s .co m*/ * * @param dataset the dataset for the chart. * * @return A sample chart. */ private JFreeChart createDistChart(String riderID) { String riderName = (String) riders.get(riderID); final JFreeChart chart = ChartFactory.createStackedBarChart(riderName + "'s Distances", // chart title "Month", // domain axis label mainDist, // range axis label (CategoryDataset) riderDistances.get(riderID), // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls ); GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); KeyToGroupMap map = new KeyToGroupMap("G1"); map.mapKeyToGroup("0", "G1"); map.mapKeyToGroup("1", "G1"); map.mapKeyToGroup("2", "G1"); map.mapKeyToGroup("3", "G1"); renderer.setSeriesToGroupMap(map); renderer.setItemMargin(0.0); Paint p1 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0x22, 0xFF), 0.0f, 0.0f, new Color(0x88, 0x88, 0xFF)); renderer.setSeriesPaint(0, p1); Paint p2 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0xFF, 0x22), 0.0f, 0.0f, new Color(0x88, 0xFF, 0x88)); renderer.setSeriesPaint(1, p2); Paint p3 = new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0x22, 0x22), 0.0f, 0.0f, new Color(0xFF, 0x88, 0x88)); renderer.setSeriesPaint(2, p3); Paint p4 = new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0xFF, 0x22), 0.0f, 0.0f, new Color(0xFF, 0xFF, 0x88)); renderer.setSeriesPaint(3, p4); renderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRenderer(renderer); plot.setFixedLegendItems(createLegendItems()); ValueAxis va = (ValueAxis) plot.getRangeAxis(); ValueAxis ova = null; try { ova = (ValueAxis) va.clone(); } catch (CloneNotSupportedException cnse) { } ova.setLabel(secondaryDist); ova.setLowerBound(va.getLowerBound() * unitConversion); ova.setUpperBound(va.getUpperBound() * unitConversion); plot.setRangeAxis(1, ova); plot.setRangeAxisLocation(1, AxisLocation.TOP_OR_RIGHT); CategoryAxis ca = plot.getDomainAxis(); ca.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); //Make around the chart transparent. chart.setBackgroundPaint(null); return chart; }
From source file:org.toobsframework.pres.chart.ChartUtil.java
public static CategoryAxis createCategoryAxis(IRequest componentRequest, DomainAxisDef categoryAxisDef, Map params, boolean is3D) { CategoryAxis categoryAxis;/* w w w. jav a 2 s .c o m*/ if (is3D) { categoryAxis = new CategoryAxis3D(); } else { categoryAxis = new CategoryAxis(); } if (categoryAxisDef != null) { if (categoryAxisDef.getDomainLabel() != null) { categoryAxis .setLabel(evaluateTextLabel(componentRequest, categoryAxisDef.getDomainLabel(), params)); if (categoryAxisDef.getDomainLabel().getFont() != null) { categoryAxis.setLabelFont(getFont(categoryAxisDef.getDomainLabel(), null)); } categoryAxis.setLabelPaint(getColor(categoryAxisDef.getDomainLabel().getColor())); } if (categoryAxisDef.getLabelPosition() != null) { Integer labelPos = domainLabelPositions.get(ParameterUtil.resolveParam(componentRequest, categoryAxisDef.getLabelPosition(), params, "standard")[0]); if (labelPos != null) { switch (labelPos) { case DOM_LABEL_STANDARD_TYPE: categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD); break; case DOM_LABEL_UP_45_TYPE: categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); break; case DOM_LABEL_DOWN_45_TYPE: categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45); break; case DOM_LABEL_UP_90_TYPE: categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); break; case DOM_LABEL_DOWN_90_TYPE: categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); break; } } } double domainMargin = Double.parseDouble(ParameterUtil.resolveParam(componentRequest, categoryAxisDef.getDomainMargin(), params, "0.0")[0]); double lowerMargin = Double.parseDouble(ParameterUtil.resolveParam(componentRequest, categoryAxisDef.getLowerMargin(), params, "0.0")[0]); double upperMargin = Double.parseDouble(ParameterUtil.resolveParam(componentRequest, categoryAxisDef.getUpperMargin(), params, "0.0")[0]); categoryAxis.setCategoryMargin(domainMargin); categoryAxis.setLowerMargin(lowerMargin); categoryAxis.setUpperMargin(upperMargin); } return categoryAxis; }
From source file:RDGraphGenerator.java
private JFreeChart createTimeChart(String riderID) { String riderName = (String) riders.get(riderID); final JFreeChart chart = ChartFactory.createStackedBarChart(riderName + "'s Hours", // chart title "Month", // domain axis label "Hours", // range axis label (CategoryDataset) riderTimes.get(riderID), // data PlotOrientation.VERTICAL, // the plot orientation true, // legend true, // tooltips false // urls );/*from w ww . j a v a2 s .c o m*/ GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); KeyToGroupMap map = new KeyToGroupMap("G1"); map.mapKeyToGroup("0", "G1"); map.mapKeyToGroup("1", "G1"); map.mapKeyToGroup("2", "G1"); map.mapKeyToGroup("3", "G1"); renderer.setSeriesToGroupMap(map); renderer.setItemMargin(0.0); Paint p1 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0x22, 0xFF), 0.0f, 0.0f, new Color(0x88, 0x88, 0xFF)); renderer.setSeriesPaint(0, p1); Paint p2 = new GradientPaint(0.0f, 0.0f, new Color(0x22, 0xFF, 0x22), 0.0f, 0.0f, new Color(0x88, 0xFF, 0x88)); renderer.setSeriesPaint(1, p2); Paint p3 = new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0x22, 0x22), 0.0f, 0.0f, new Color(0xFF, 0x88, 0x88)); renderer.setSeriesPaint(2, p3); Paint p4 = new GradientPaint(0.0f, 0.0f, new Color(0xFF, 0xFF, 0x22), 0.0f, 0.0f, new Color(0xFF, 0xFF, 0x88)); renderer.setSeriesPaint(3, p4); renderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL)); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRenderer(renderer); plot.setFixedLegendItems(createLegendItems()); CategoryAxis ca = plot.getDomainAxis(); ca.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); //Make around the chart transparent. chart.setBackgroundPaint(null); return chart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *//*from w ww .ja va2s.co m*/ protected void configurePlot(Plot plot) { plot.setOutlinePaint(null); if (getPlot().getOwnBackcolor() == null)// in a way, plot backcolor inheritence from chart is useless { plot.setBackgroundPaint(null); } else { plot.setBackgroundPaint(getPlot().getBackcolor()); } float backgroundAlpha = getPlot().getBackgroundAlphaFloat() == null ? 1f : getPlot().getBackgroundAlphaFloat(); float foregroundAlpha = getPlot().getForegroundAlphaFloat() == null ? 1f : getPlot().getForegroundAlphaFloat(); plot.setBackgroundAlpha(backgroundAlpha); plot.setForegroundAlpha(foregroundAlpha); if (plot instanceof CategoryPlot) { // Handle rotation of the category labels. CategoryAxis axis = ((CategoryPlot) plot).getDomainAxis(); // it's OK to use deprecated method here; avoiding it means attempting cast operations double labelRotation = getLabelRotation(); if (labelRotation == 90) { axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); } else if (labelRotation == -90) { axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); } else if (labelRotation < 0) { axis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions((-labelRotation / 180.0) * Math.PI)); } else if (labelRotation > 0) { axis.setCategoryLabelPositions( CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI)); } } // Set any color series SortedSet<JRSeriesColor> seriesColors = getPlot().getSeriesColors(); if (seriesColors != null && seriesColors.size() > 0) { if (seriesColors.size() == 1) { // Add the single color to the beginning of the color cycle, using all the default // colors. To replace the defaults you have to specify at least two colors. Paint[] colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + 1]; colors[0] = seriesColors.first().getColor(); System.arraycopy(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, 0, colors, 1, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length); plot.setDrawingSupplier( new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); } else if (seriesColors.size() > 1) { // Set up a custom drawing supplier that cycles through the user's colors // instead of the default colors. Color[] colors = new Color[seriesColors.size()]; JRSeriesColor[] colorSequence = new JRSeriesColor[seriesColors.size()]; seriesColors.toArray(colorSequence); for (int i = 0; i < colorSequence.length; i++) { colors[i] = colorSequence[i].getColor(); } plot.setDrawingSupplier( new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); } } }
From source file:com.android.ddmuilib.HeapPanel.java
/** * Creates the chart below the statistics table *//*from ww w. j av a 2 s . c o m*/ private void createChart() { mAllocCountDataSet = new DefaultCategoryDataset(); mChart = ChartFactory.createBarChart(null, "Size", "Count", mAllocCountDataSet, PlotOrientation.VERTICAL, false, true, false); // get the font to make a proper title. We need to convert the swt font, // into an awt font. Font f = mStatisticsBase.getFont(); FontData[] fData = f.getFontData(); // event though on Mac OS there could be more than one fontData, we'll only use // the first one. FontData firstFontData = fData[0]; java.awt.Font awtFont = SWTUtils.toAwtFont(mStatisticsBase.getDisplay(), firstFontData, true /* ensureSameSize */); mChart.setTitle(new TextTitle("Allocation count per size", awtFont)); Plot plot = mChart.getPlot(); if (plot instanceof CategoryPlot) { // get the plot CategoryPlot categoryPlot = (CategoryPlot) plot; // set the domain axis to draw labels that are displayed even with many values. CategoryAxis domainAxis = categoryPlot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); CategoryItemRenderer renderer = categoryPlot.getRenderer(); renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() { @Override public String generateToolTip(CategoryDataset dataset, int row, int column) { // get the key for the size of the allocation ByteLong columnKey = (ByteLong) dataset.getColumnKey(column); String rowKey = (String) dataset.getRowKey(row); Number value = dataset.getValue(rowKey, columnKey); return String.format("%1$d %2$s of %3$d bytes", value.intValue(), rowKey, columnKey.getValue()); } }); } mChartComposite = new ChartComposite(mStatisticsBase, SWT.BORDER, mChart, ChartComposite.DEFAULT_WIDTH, ChartComposite.DEFAULT_HEIGHT, ChartComposite.DEFAULT_MINIMUM_DRAW_WIDTH, ChartComposite.DEFAULT_MINIMUM_DRAW_HEIGHT, 3000, // max draw width. We don't want it to zoom, so we put a big number 3000, // max draw height. We don't want it to zoom, so we put a big number true, // off-screen buffer true, // properties true, // save true, // print false, // zoom true); // tooltips mChartComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); }