Example usage for org.jfree.chart.fx ChartViewer setMaxWidth

List of usage examples for org.jfree.chart.fx ChartViewer setMaxWidth

Introduction

In this page you can find the example usage for org.jfree.chart.fx ChartViewer setMaxWidth.

Prototype

public final void setMaxWidth(double value) 

Source Link

Usage

From source file:com.bdb.weather.display.summary.RainHourChart.java

public RainHourChart() {
    for (int i = 0; i < 24; i++)
        hourRainDataset.addValue(0.0, CATEGORY_NAME, Integer.toString(i));

    JFreeChart rainChart = ChartFactory.createBarChart(null, "Hour", "", hourRainDataset,
            PlotOrientation.VERTICAL, false, true, false);
    ChartViewer rainChartViewer = new ChartViewer(rainChart);
    rainChartViewer.setMaxHeight(10000);
    rainChartViewer.setMaxWidth(10000);
    rainChartViewer.setPrefSize(800, 200);
    plot = (CategoryPlot) rainChart.getPlot();
    plot.setRangeAxis(RainRangeAxis.create());
    this.getChildren().add(rainChartViewer);
}

From source file:com.bdb.weather.display.freeplot.FreePlot.java

/**
 * Constructor.//from   www  .  ja  v a 2s . c o  m
 * 
 * @param seriesFactory The factory for creating the series
 * @param controlFactory The factory for creating the controls
 */

@SuppressWarnings("LeakingThisInConstructor")
FreePlot(SeriesCollectionFactory seriesFactory) {
    controls = seriesFactory.createSeriesGroupControls(this);
    factory = seriesFactory;
    this.setTop(createDataRangeSelectionPanel());
    this.setLeft(createDataSelectionPanel(controls.values()));

    ChartViewer chartViewer = new ChartViewer(new JFreeChart(plot));
    chartViewer.setMaxHeight(20000);
    chartViewer.setMaxWidth(20000);
    this.setCenter(chartViewer);

    //
    // Create a default Y Axis
    //
    DateAxis dateAxis = new DateAxis("Date/Time");
    plot.setDomainAxis(dateAxis);
    plot.setRangeAxis(new NumberAxis("Data"));
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);

    buildStrokes();
}

From source file:com.bdb.weather.display.current.Barometer.java

private ChartViewer createChartElements(Pressure min, Pressure max) {
    Color backgroundDialColor = StageUtilities
            .toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_DIAL_COLOR));
    Paint backgroundPaint = new GradientPaint(0.0f, 0.0f, Color.LIGHT_GRAY, 100.0f, 0.0f, backgroundDialColor);
    DialBackground background = new DialBackground(backgroundPaint);
    plot.addLayer(background);/*w  w w .j a  v a 2s .  c  o m*/
    double dialTickIncrements = .2;
    switch (Pressure.getDefaultUnit()) {
    case IN_HG:
        dialTickIncrements = .2;
        break;
    case HECTO_PASCAL:
    case MILLIBAR:
        dialTickIncrements = 10.0;
        break;
    }

    scale = new StandardDialScale(min.get(), max.get(), 240.0, -300.0, dialTickIncrements, 10);
    scale.setTickLabelFont(scale.getTickLabelFont().deriveFont(14.0F).deriveFont(Font.PLAIN));
    scale.setTickRadius(.9);
    scale.setTickLabelFormatter(Pressure.getDefaultFormatter());
    scale.setTickLabelOffset(.25);
    scale.setTickLabelPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TEXT)));
    scale.setMajorTickPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK)));
    scale.setMinorTickPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_SCALE_TICK)));
    plot.addScale(0, scale);
    plot.setDialFrame(new StandardDialFrame());
    DialValueIndicator valueInd = new DialValueIndicator(0);
    //
    // Set background and outline paint to be completely transparent so they do not show at all
    //
    valueInd.setBackgroundPaint(new Color(255, 255, 255, 0));
    valueInd.setOutlinePaint(new Color(255, 255, 255, 0));
    valueInd.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE)));
    valueInd.setNumberFormat(Pressure.getDefaultUnit().getFormatterWithUnit());
    plot.addLayer(valueInd);

    double angle = valueInd.getAngle();
    double radius = valueInd.getRadius();

    trendAnnotation.setPaint(StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE)));
    trendAnnotation.setAngle(angle);
    trendAnnotation.setRadius(radius + .1);
    plot.addLayer(trendAnnotation);

    DialPointer.Pointer pointer = new DialPointer.Pointer(0);
    plot.addPointer(pointer);

    DialCap cap = new DialCap();
    cap.setRadius(cap.getRadius() * 1.5);
    plot.setCap(cap);

    range = new StandardDialRange(0.0, 360.0,
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_VALUE_RANGE)));
    range.setInnerRadius(.40);
    range.setOuterRadius(.45);
    range.setScaleIndex(0);
    plot.addLayer(range);

    JFreeChart chart = new JFreeChart(plot);
    chart.setBackgroundPaint(
            StageUtilities.toAwtColor(colorPrefs.getColorPref(ColorPreferences.GUAGE_BACKGROUND)));

    ChartViewer chartViewer = new ChartViewer(chart);
    chartViewer.setMinHeight(200);
    chartViewer.setMinWidth(200);
    chartViewer.setMaxHeight(10000);
    chartViewer.setMaxWidth(10000);

    //chartViewer.setBorder(new BevelBorder(BevelBorder.RAISED));

    return chartViewer;
}