Java Code Examples for org.jfree.chart.fx.ChartViewer#getRenderingInfo()

The following examples show how to use org.jfree.chart.fx.ChartViewer#getRenderingInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Data width to pixel width on screen
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcWidthOnScreen(ChartViewer myChart, double dataWidth, ValueAxis axis,
    RectangleEdge axisEdge) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();

  // width 2D
  return axis.lengthToJava2D(dataWidth, dataArea, axisEdge);
}
 
Example 2
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * Domain and Range axes need to share the same unit (e.g. mm)
 * 
 * @param myChart
 * @return
 */
public static double calcWidthToHeight(ChartViewer myChart, double chartHeight) {
  makeChartResizable(myChart);

  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();

  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;

  return width;
}
 
Example 3
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Data width to pixel width on screen
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcWidthOnScreen(ChartViewer myChart, double dataWidth, ValueAxis axis,
    RectangleEdge axisEdge) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();

  // width 2D
  return axis.lengthToJava2D(dataWidth, dataArea, axisEdge);
}
 
Example 4
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * Domain and Range axes need to share the same unit (e.g. mm)
 * 
 * @param myChart
 * @return
 */
public static double calcWidthToHeight(ChartViewer myChart, double chartHeight) {
  makeChartResizable(myChart);

  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();


  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;

  return width;
}
 
Example 5
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Data width to pixel width on screen
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcWidthOnScreen(ChartViewer myChart, double dataWidth, ValueAxis axis,
    RectangleEdge axisEdge) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();

  // width 2D
  return axis.lengthToJava2D(dataWidth, dataArea, axisEdge);
}
 
Example 6
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 
 * Domain and Range axes need to share the same unit (e.g. mm)
 * 
 * @param myChart
 * @return
 */
public static double calcWidthToHeight(ChartViewer myChart, double chartHeight) {
  makeChartResizable(myChart);

  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();


  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;

  return width;
}
 
Example 7
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Calculates the size of a chart for a given fixed plot width and height
 * 
 * @param chart
 * @param plotWidth
 * @return
 */
public static Dimension calcSizeForPlotSize(ChartViewer myChart, double plotWidth,
    double plotHeight, int iterations) {
  makeChartResizable(myChart);

  // estimate plotwidth / height
  double estimatedChartWidth = plotWidth + 200;
  double estimatedChartHeight = plotHeight + 200;

  double lastW = estimatedChartWidth;
  double lastH = estimatedChartHeight;

  // paint and get closer
  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy
      // panel==true)
      myChart.getCanvas().setWidth((int) estimatedChartWidth);
      myChart.getCanvas().setHeight((int) estimatedChartHeight);
      myChart.getCanvas().draw();

      // rendering info
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // // calc title space: will be added later to the right plot
      // size
      // double titleWidth = chartArea.getWidth()-dataArea.getWidth();
      // double titleHeight =
      // chartArea.getHeight()-dataArea.getHeight();

      // calc width and height
      estimatedChartWidth = estimatedChartWidth - dataArea.getWidth() + plotWidth;
      estimatedChartHeight = estimatedChartHeight - dataArea.getHeight() + plotHeight;

      if ((int) lastW == (int) estimatedChartWidth && (int) lastH == (int) estimatedChartHeight)
        break;
      else {
        lastW = estimatedChartWidth;
        lastH = estimatedChartHeight;
      }
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return new Dimension((int) estimatedChartWidth, (int) estimatedChartHeight);
}
 
Example 8
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * calculates the correct height with multiple iterations Domain and Range axes need to share the
 * same unit (e.g. mm)
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcHeightToWidth(ChartViewer myChart, double chartWidth,
    double estimatedHeight, int iterations) {
  // if(myChart.getChartRenderingInfo()==null ||
  // myChart.getChartRenderingInfo().getChartArea()==null ||
  // myChart.getChartRenderingInfo().getChartArea().getWidth()==0)
  // result
  double height = estimatedHeight;
  double lastH = height;

  makeChartResizable(myChart);

  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy
      // panel==true)
      myChart.getCanvas().setWidth((int) chartWidth);
      myChart.getCanvas().setHeight((int) estimatedHeight);
      myChart.getCanvas().draw();

      XYPlot plot = (XYPlot) myChart.getChart().getPlot();
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // calc title space: will be added later to the right plot size
      double titleWidth = chartArea.getWidth() - dataArea.getWidth();
      double titleHeight = chartArea.getHeight() - dataArea.getHeight();

      // calc right plot size with axis dim.
      // real plot width is given by factor;
      double realPW = chartWidth - titleWidth;

      // ranges
      ValueAxis domainAxis = plot.getDomainAxis();
      org.jfree.data.Range x = domainAxis.getRange();
      ValueAxis rangeAxis = plot.getRangeAxis();
      org.jfree.data.Range y = rangeAxis.getRange();

      // real plot height can be calculated by
      double realPH = realPW / x.getLength() * y.getLength();

      // the real height
      height = realPH + titleHeight;

      // for next iteration
      estimatedHeight = height;
      if ((int) lastH == (int) height)
        break;
      else
        lastH = height;
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return height;
}
 
Example 9
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns dimensions for limiting factor width or height
 * 
 * @param myChart
 * @return
 */
public static Dimension calcMaxSize(ChartViewer myChart, double chartWidth, double chartHeight) {
  makeChartResizable(myChart);
  // paint on a ghost panel
  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();

  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calculatig width for max height

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;
  // if width is higher than given chartWidth then calc height for
  // chartWidth
  if (width > chartWidth) {
    // calc right plot size with axis dim.
    // real plot width is given by factor;
    realPW = chartWidth - titleWidth;

    // real plot height can be calculated by
    realPH = realPW / x.getLength() * y.getLength();

    double height = realPH + titleHeight;
    // Return size
    return new Dimension((int) chartWidth, (int) height);
  } else {
    // Return size
    return new Dimension((int) width, (int) chartHeight);
  }
}
 
Example 10
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Calculates the size of a chart for a given fixed plot width and height
 * 
 * @param chart
 * @param plotWidth
 * @return
 */
public static Dimension calcSizeForPlotSize(ChartViewer myChart, double plotWidth,
    double plotHeight, int iterations) {
  makeChartResizable(myChart);

  // estimate plotwidth / height
  double estimatedChartWidth = plotWidth + 200;
  double estimatedChartHeight = plotHeight + 200;

  double lastW = estimatedChartWidth;
  double lastH = estimatedChartHeight;

  // paint and get closer
  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy panel==true)
      myChart.getCanvas().setWidth((int) estimatedChartWidth);
      myChart.getCanvas().setHeight((int) estimatedChartHeight);
      myChart.getCanvas().draw();

      // rendering info
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // // calc title space: will be added later to the right plot size
      // double titleWidth = chartArea.getWidth()-dataArea.getWidth();
      // double titleHeight = chartArea.getHeight()-dataArea.getHeight();

      // calc width and height
      estimatedChartWidth = estimatedChartWidth - dataArea.getWidth() + plotWidth;
      estimatedChartHeight = estimatedChartHeight - dataArea.getHeight() + plotHeight;

      if ((int) lastW == (int) estimatedChartWidth && (int) lastH == (int) estimatedChartHeight)
        break;
      else {
        lastW = estimatedChartWidth;
        lastH = estimatedChartHeight;
      }
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return new Dimension((int) estimatedChartWidth, (int) estimatedChartHeight);
}
 
Example 11
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * calculates the correct height with multiple iterations Domain and Range axes need to share the
 * same unit (e.g. mm)
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcHeightToWidth(ChartViewer myChart, double chartWidth,
    double estimatedHeight, int iterations) {
  // if(myChart.getChartRenderingInfo()==null ||
  // myChart.getChartRenderingInfo().getChartArea()==null ||
  // myChart.getChartRenderingInfo().getChartArea().getWidth()==0)
  // result
  double height = estimatedHeight;
  double lastH = height;

  makeChartResizable(myChart);

  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy panel==true)
      myChart.getCanvas().setWidth((int) chartWidth);
      myChart.getCanvas().setHeight((int) estimatedHeight);
      myChart.getCanvas().draw();

      XYPlot plot = (XYPlot) myChart.getChart().getPlot();
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // calc title space: will be added later to the right plot size
      double titleWidth = chartArea.getWidth() - dataArea.getWidth();
      double titleHeight = chartArea.getHeight() - dataArea.getHeight();

      // calc right plot size with axis dim.
      // real plot width is given by factor;
      double realPW = chartWidth - titleWidth;

      // ranges
      ValueAxis domainAxis = plot.getDomainAxis();
      org.jfree.data.Range x = domainAxis.getRange();
      ValueAxis rangeAxis = plot.getRangeAxis();
      org.jfree.data.Range y = rangeAxis.getRange();

      // real plot height can be calculated by
      double realPH = realPW / x.getLength() * y.getLength();

      // the real height
      height = realPH + titleHeight;

      // for next iteration
      estimatedHeight = height;
      if ((int) lastH == (int) height)
        break;
      else
        lastH = height;
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return height;
}
 
Example 12
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns dimensions for limiting factor width or height
 * 
 * @param myChart
 * @return
 */
public static Dimension calcMaxSize(ChartViewer myChart, double chartWidth, double chartHeight) {
  makeChartResizable(myChart);
  // paint on a ghost panel
  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();


  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calculatig width for max height

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;
  // if width is higher than given chartWidth then calc height for chartWidth
  if (width > chartWidth) {
    // calc right plot size with axis dim.
    // real plot width is given by factor;
    realPW = chartWidth - titleWidth;

    // real plot height can be calculated by
    realPH = realPW / x.getLength() * y.getLength();

    double height = realPH + titleHeight;
    // Return size
    return new Dimension((int) chartWidth, (int) height);
  } else {
    // Return size
    return new Dimension((int) width, (int) chartHeight);
  }
}
 
Example 13
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Calculates the size of a chart for a given fixed plot width and height
 * 
 * @param chart
 * @param plotWidth
 * @return
 */
public static Dimension calcSizeForPlotSize(ChartViewer myChart, double plotWidth,
    double plotHeight, int iterations) {
  makeChartResizable(myChart);

  // estimate plotwidth / height
  double estimatedChartWidth = plotWidth + 200;
  double estimatedChartHeight = plotHeight + 200;

  double lastW = estimatedChartWidth;
  double lastH = estimatedChartHeight;

  // paint and get closer
  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy panel==true)
      myChart.getCanvas().setWidth((int) estimatedChartWidth);
      myChart.getCanvas().setHeight((int) estimatedChartHeight);
      myChart.getCanvas().draw();

      // rendering info
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // // calc title space: will be added later to the right plot size
      // double titleWidth = chartArea.getWidth()-dataArea.getWidth();
      // double titleHeight = chartArea.getHeight()-dataArea.getHeight();

      // calc width and height
      estimatedChartWidth = estimatedChartWidth - dataArea.getWidth() + plotWidth;
      estimatedChartHeight = estimatedChartHeight - dataArea.getHeight() + plotHeight;

      if ((int) lastW == (int) estimatedChartWidth && (int) lastH == (int) estimatedChartHeight)
        break;
      else {
        lastW = estimatedChartWidth;
        lastH = estimatedChartHeight;
      }
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return new Dimension((int) estimatedChartWidth, (int) estimatedChartHeight);
}
 
Example 14
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * calculates the correct height with multiple iterations Domain and Range axes need to share the
 * same unit (e.g. mm)
 * 
 * @param myChart
 * @param dataWidth width of data
 * @param axis for width calculation
 * @return
 */
public static double calcHeightToWidth(ChartViewer myChart, double chartWidth,
    double estimatedHeight, int iterations) {
  // if(myChart.getChartRenderingInfo()==null ||
  // myChart.getChartRenderingInfo().getChartArea()==null ||
  // myChart.getChartRenderingInfo().getChartArea().getWidth()==0)
  // result
  double height = estimatedHeight;
  double lastH = height;

  makeChartResizable(myChart);

  try {
    for (int i = 0; i < iterations; i++) {
      // paint on ghost panel with estimated height (if copy panel==true)
      myChart.getCanvas().setWidth((int) chartWidth);
      myChart.getCanvas().setHeight((int) estimatedHeight);
      myChart.getCanvas().draw();

      XYPlot plot = (XYPlot) myChart.getChart().getPlot();
      ChartRenderingInfo info = myChart.getRenderingInfo();
      Rectangle2D dataArea = info.getPlotInfo().getDataArea();
      Rectangle2D chartArea = info.getChartArea();

      // calc title space: will be added later to the right plot size
      double titleWidth = chartArea.getWidth() - dataArea.getWidth();
      double titleHeight = chartArea.getHeight() - dataArea.getHeight();

      // calc right plot size with axis dim.
      // real plot width is given by factor;
      double realPW = chartWidth - titleWidth;

      // ranges
      ValueAxis domainAxis = plot.getDomainAxis();
      org.jfree.data.Range x = domainAxis.getRange();
      ValueAxis rangeAxis = plot.getRangeAxis();
      org.jfree.data.Range y = rangeAxis.getRange();

      // real plot height can be calculated by
      double realPH = realPW / x.getLength() * y.getLength();

      // the real height
      height = realPH + titleHeight;

      // for next iteration
      estimatedHeight = height;
      if ((int) lastH == (int) height)
        break;
      else
        lastH = height;
    }
  } catch (Exception ex) {
    ex.printStackTrace();
  }

  return height;
}
 
Example 15
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns dimensions for limiting factor width or height
 * 
 * @param myChart
 * @return
 */
public static Dimension calcMaxSize(ChartViewer myChart, double chartWidth, double chartHeight) {
  makeChartResizable(myChart);
  // paint on a ghost panel
  myChart.getCanvas().draw();

  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ChartRenderingInfo info = myChart.getRenderingInfo();
  Rectangle2D dataArea = info.getPlotInfo().getDataArea();
  Rectangle2D chartArea = info.getChartArea();


  // calc title space: will be added later to the right plot size
  double titleWidth = chartArea.getWidth() - dataArea.getWidth();
  double titleHeight = chartArea.getHeight() - dataArea.getHeight();

  // calculatig width for max height

  // calc right plot size with axis dim.
  // real plot width is given by factor;
  double realPH = chartHeight - titleHeight;

  // ranges
  ValueAxis domainAxis = plot.getDomainAxis();
  org.jfree.data.Range x = domainAxis.getRange();
  ValueAxis rangeAxis = plot.getRangeAxis();
  org.jfree.data.Range y = rangeAxis.getRange();

  // real plot height can be calculated by
  double realPW = realPH / y.getLength() * x.getLength();

  double width = realPW + titleWidth;
  // if width is higher than given chartWidth then calc height for chartWidth
  if (width > chartWidth) {
    // calc right plot size with axis dim.
    // real plot width is given by factor;
    realPW = chartWidth - titleWidth;

    // real plot height can be calculated by
    realPH = realPW / x.getLength() * y.getLength();

    double height = realPH + titleHeight;
    // Return size
    return new Dimension((int) chartWidth, (int) height);
  } else {
    // Return size
    return new Dimension((int) width, (int) chartHeight);
  }
}