Example #1
0
  /**
   * Returns a panel containing the content for the demo. This method is used across all the
   * individual demo applications to allow aggregation into a single "umbrella" demo
   * (OrsonChartsDemo).
   *
   * @return A panel containing the content for the demo.
   */
  public static JPanel createDemoPanel() {
    DemoPanel content = new CustomDemoPanel(new BorderLayout());
    content.setPreferredSize(OrsonChartsDemo.DEFAULT_CONTENT_SIZE);
    CategoryDataset3D dataset = createDataset();
    Chart3D chart =
        Chart3DFactory.createAreaChart(
            "AxisRangeDemo1",
            "A test for rendering with a restricted value range",
            dataset,
            "Row",
            "Category",
            "Value");
    chart.setChartBoxColor(new Color(255, 255, 255, 128));
    chart.setViewPoint(ViewPoint3D.createAboveLeftViewPoint(40));

    CategoryPlot3D plot = (CategoryPlot3D) chart.getPlot();
    plot.getValueAxis().setRange(-500, 500);
    plot.getRowAxis().setVisible(false);

    AreaRenderer3D renderer = (AreaRenderer3D) plot.getRenderer();
    renderer.setItemLabelGenerator(
        new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.VALUE_TEMPLATE));
    Chart3DPanel chartPanel = new Chart3DPanel(chart);
    content.setChartPanel(chartPanel);
    content.add(new DisplayPanel3D(chartPanel));
    chartPanel.zoomToFit(OrsonChartsDemo.DEFAULT_CONTENT_SIZE);

    return content;
  }
Example #2
0
 @Override
 public void stateChanged(ChangeEvent e) {
   Chart3D chart = (Chart3D) getChartPanel().getDrawable();
   CategoryPlot3D plot = (CategoryPlot3D) chart.getPlot();
   ValueAxis3D yAxis = plot.getValueAxis();
   int min = this.slider1.getValue();
   int max = this.slider2.getValue();
   if (min != max) {
     yAxis.setRange(min, max);
   }
 }