Example usage for org.jfree.chart.plot XYPlot setDomainCrosshairVisible

List of usage examples for org.jfree.chart.plot XYPlot setDomainCrosshairVisible

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setDomainCrosshairVisible.

Prototype

public void setDomainCrosshairVisible(boolean flag) 

Source Link

Document

Sets the flag indicating whether or not the domain crosshair is visible and, if the flag changes, sends a PlotChangeEvent to all registered listeners.

Usage

From source file:net.nikr.eve.jeveasset.gui.tabs.tracker.TrackerTab.java

public TrackerTab(Program program) {
    super(program, TabsTracker.get().title(), Images.TOOL_TRACKER.getIcon(), true);

    filterDialog = new TrackerFilterDialog(program);

    jPopupMenu = new JPopupMenu();
    jPopupMenu.addPopupMenuListener(listener);

    JMenuItem jMenuItem;//from   ww w.j  a  va 2s . c om
    jMenuItem = new JMenuItem(TabsTracker.get().edit(), Images.EDIT_EDIT.getIcon());
    jMenuItem.setActionCommand(TrackerAction.EDIT.name());
    jMenuItem.addActionListener(listener);
    jPopupMenu.add(jMenuItem);

    jMenuItem = new JMenuItem(TabsTracker.get().delete(), Images.EDIT_DELETE.getIcon());
    jMenuItem.setActionCommand(TrackerAction.DELETE.name());
    jMenuItem.addActionListener(listener);
    jPopupMenu.add(jMenuItem);

    JMenuInfo.createDefault(jPopupMenu);

    jIskValue = new JMenuItem();
    jIskValue.setEnabled(false);
    jIskValue.setForeground(Color.BLACK);
    jIskValue.setHorizontalAlignment(SwingConstants.RIGHT);
    jIskValue.setDisabledIcon(Images.TOOL_VALUES.getIcon());
    jPopupMenu.add(jIskValue);

    jDateValue = new JMenuItem();
    jDateValue.setEnabled(false);
    jDateValue.setForeground(Color.BLACK);
    jDateValue.setHorizontalAlignment(SwingConstants.RIGHT);
    jPopupMenu.add(jDateValue);

    jEditDialog = new JTrackerEditDialog(program);

    jSelectionDialog = new JSelectionDialog(program);

    JSeparator jDateSeparator = new JSeparator();

    jQuickDate = new JComboBox<QuickDate>(QuickDate.values());
    jQuickDate.setActionCommand(TrackerAction.QUICK_DATE.name());
    jQuickDate.addActionListener(listener);

    JLabel jFromLabel = new JLabel(TabsTracker.get().from());
    jFrom = createDateChooser();

    JLabel jToLabel = new JLabel(TabsTracker.get().to());
    jTo = createDateChooser();

    jAll = new JCheckBox(General.get().all());
    jAll.setSelected(true);
    jAll.setActionCommand(TrackerAction.ALL.name());
    jAll.addActionListener(listener);
    jAll.setFont(new Font(jAll.getFont().getName(), Font.ITALIC, jAll.getFont().getSize()));

    jTotal = new JCheckBox(TabsTracker.get().total());
    jTotal.setSelected(true);
    jTotal.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jTotal.addActionListener(listener);

    jWalletBalance = new JCheckBox(TabsTracker.get().walletBalance());
    jWalletBalance.setSelected(true);
    jWalletBalance.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jWalletBalance.addActionListener(listener);

    jWalletBalanceFilters = new JButton(Images.LOC_INCLUDE.getIcon());
    jWalletBalanceFilters.setActionCommand(TrackerAction.FILTER_WALLET_BALANCE.name());
    jWalletBalanceFilters.addActionListener(listener);

    jAssets = new JCheckBox(TabsTracker.get().assets());
    jAssets.setSelected(true);
    jAssets.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jAssets.addActionListener(listener);

    jAssetsFilters = new JButton(Images.LOC_INCLUDE.getIcon());
    jAssetsFilters.setActionCommand(TrackerAction.FILTER_ASSETS.name());
    jAssetsFilters.addActionListener(listener);

    jSellOrders = new JCheckBox(TabsTracker.get().sellOrders());
    jSellOrders.setSelected(true);
    jSellOrders.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jSellOrders.addActionListener(listener);

    jEscrows = new JCheckBox(TabsTracker.get().escrows());
    jEscrows.setSelected(true);
    jEscrows.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jEscrows.addActionListener(listener);

    jEscrowsToCover = new JCheckBox(TabsTracker.get().escrowsToCover());
    jEscrowsToCover.setSelected(true);
    jEscrowsToCover.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jEscrowsToCover.addActionListener(listener);

    jManufacturing = new JCheckBox(TabsTracker.get().manufacturing());
    jManufacturing.setSelected(true);
    jManufacturing.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jManufacturing.addActionListener(listener);

    jContractCollateral = new JCheckBox(TabsTracker.get().contractCollateral());
    jContractCollateral.setSelected(true);
    jContractCollateral.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jContractCollateral.addActionListener(listener);

    jContractValue = new JCheckBox(TabsTracker.get().contractValue());
    jContractValue.setSelected(true);
    jContractValue.setActionCommand(TrackerAction.UPDATE_SHOWN.name());
    jContractValue.addActionListener(listener);

    JSeparator jOwnersSeparator = new JSeparator();

    jAllProfiles = new JCheckBox(TabsTracker.get().allProfiles());
    jAllProfiles.setActionCommand(TrackerAction.PROFILE.name());
    jAllProfiles.addActionListener(listener);

    jOwners = new JMultiSelectionList<String>();
    jOwners.getSelectionModel().addListSelectionListener(listener);
    JScrollPane jOwnersScroll = new JScrollPane(jOwners);

    JLabel jHelp = new JLabel(TabsTracker.get().help());
    jHelp.setIcon(Images.MISC_HELP.getIcon());

    JLabel jNoFilter = new JLabel(TabsTracker.get().helpLegacyData());
    jNoFilter.setIcon(new ShapeIcon(NO_FILTER));

    JLabel jFilter = new JLabel(TabsTracker.get().helpNewData());
    jFilter.setIcon(new ShapeIcon(FILTER_AND_DEFAULT));

    JDropDownButton jSettings = new JDropDownButton(Images.DIALOG_SETTINGS.getIcon());

    jIncludeZero = new JCheckBoxMenuItem(TabsTracker.get().includeZero());
    jIncludeZero.setSelected(true);
    jIncludeZero.setActionCommand(TrackerAction.INCLUDE_ZERO.name());
    jIncludeZero.addActionListener(listener);
    jSettings.add(jIncludeZero);

    DateAxis domainAxis = new DateAxis();
    domainAxis.setDateFormatOverride(dateFormat);
    domainAxis.setVerticalTickLabels(true);
    domainAxis.setAutoTickUnitSelection(true);
    domainAxis.setAutoRange(true);
    domainAxis.setTickLabelFont(jFromLabel.getFont());

    NumberAxis rangeAxis = new NumberAxis();
    rangeAxis.setAutoRange(true);
    rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
    rangeAxis.setTickLabelFont(jFromLabel.getFont());

    //XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, new XYLineAndShapeRenderer(true, true));
    render = new MyRender();
    XYPlot plot = new XYPlot(dataset, domainAxis, rangeAxis, render);
    plot.setBackgroundPaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    plot.getRenderer()
            .setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: {2} ({1})", dateFormat, iskFormat));
    plot.setDomainCrosshairLockedOnData(true);
    plot.setDomainCrosshairStroke(new BasicStroke(1));
    plot.setDomainCrosshairPaint(Color.BLACK);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairLockedOnData(true);
    plot.setRangeCrosshairVisible(false);

    jNextChart = new JFreeChart(plot);
    jNextChart.setAntiAlias(true);
    jNextChart.setBackgroundPaint(jPanel.getBackground());
    jNextChart.addProgressListener(null);
    jNextChart.getLegend().setItemFont(jFrom.getFont());

    jChartPanel = new ChartPanel(jNextChart);
    jChartPanel.addMouseListener(listener);
    jChartPanel.setDomainZoomable(false);
    jChartPanel.setRangeZoomable(false);
    jChartPanel.setPopupMenu(null);
    jChartPanel.addChartMouseListener(listener);
    jChartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
    jChartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
    jChartPanel.setMinimumDrawWidth(10);
    jChartPanel.setMinimumDrawHeight(10);

    int AssetsGapWidth = PANEL_WIDTH - jAssets.getPreferredSize().width
            - jAssetsFilters.getPreferredSize().width;
    if (AssetsGapWidth < 0) {
        AssetsGapWidth = 0;
    }
    int WalletGapWidth = PANEL_WIDTH - jWalletBalance.getPreferredSize().width
            - jWalletBalanceFilters.getPreferredSize().width;
    if (WalletGapWidth < 0) {
        WalletGapWidth = 0;
    }

    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup()
            .addGroup(layout.createSequentialGroup().addComponent(jHelp).addGap(20).addComponent(jNoFilter)
                    .addGap(20).addComponent(jFilter).addGap(20, 20, Integer.MAX_VALUE).addComponent(jSettings)
                    .addGap(6))
            .addComponent(jChartPanel)).addGroup(
                    layout.createParallelGroup().addComponent(jQuickDate, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup()
                                            .addComponent(jFromLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH)
                                            .addComponent(jToLabel, LABEL_WIDTH, LABEL_WIDTH, LABEL_WIDTH))
                                    .addGap(0)
                                    .addGroup(layout.createParallelGroup()
                                            .addComponent(jFrom, PANEL_WIDTH - LABEL_WIDTH,
                                                    PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH)
                                            .addComponent(jTo, PANEL_WIDTH - LABEL_WIDTH,
                                                    PANEL_WIDTH - LABEL_WIDTH, PANEL_WIDTH - LABEL_WIDTH)))
                            .addComponent(jDateSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jAll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jTotal, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addGroup(layout.createSequentialGroup().addComponent(jWalletBalance)
                                    .addGap(0, 0, WalletGapWidth).addComponent(jWalletBalanceFilters))
                            .addGroup(layout.createSequentialGroup().addComponent(jAssets)
                                    .addGap(0, 0, AssetsGapWidth).addComponent(jAssetsFilters))
                            .addComponent(jSellOrders, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jEscrows, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jEscrowsToCover, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jManufacturing, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jContractCollateral, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jContractValue, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jOwnersSeparator, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jAllProfiles, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)
                            .addComponent(jOwnersScroll, PANEL_WIDTH, PANEL_WIDTH, PANEL_WIDTH)));
    layout.setVerticalGroup(layout.createParallelGroup()
            .addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup()
                    .addComponent(jHelp, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jNoFilter, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jFilter, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jSettings, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight()))
                    .addComponent(jChartPanel))
            .addGroup(layout.createSequentialGroup()
                    .addComponent(jQuickDate, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addGroup(layout.createParallelGroup()
                            .addComponent(jFromLabel, Program.getButtonsHeight(), Program.getButtonsHeight(),
                                    Program.getButtonsHeight())
                            .addComponent(jFrom, Program.getButtonsHeight(), Program.getButtonsHeight(),
                                    Program.getButtonsHeight()))
                    .addGroup(layout.createParallelGroup()
                            .addComponent(jToLabel, Program.getButtonsHeight(), Program.getButtonsHeight(),
                                    Program.getButtonsHeight())
                            .addComponent(jTo, Program.getButtonsHeight(), Program.getButtonsHeight(),
                                    Program.getButtonsHeight()))
                    .addComponent(jDateSeparator, 3, 3, 3)
                    .addComponent(jAll, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jTotal, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addGroup(layout.createParallelGroup()
                            .addComponent(jWalletBalance, Program.getButtonsHeight(),
                                    Program.getButtonsHeight(), Program.getButtonsHeight())
                            .addComponent(jWalletBalanceFilters, Program.getButtonsHeight(),
                                    Program.getButtonsHeight(), Program.getButtonsHeight()))
                    .addGroup(layout.createParallelGroup()
                            .addComponent(jAssets, Program.getButtonsHeight(), Program.getButtonsHeight(),
                                    Program.getButtonsHeight())
                            .addComponent(jAssetsFilters, Program.getButtonsHeight(),
                                    Program.getButtonsHeight(), Program.getButtonsHeight()))
                    .addComponent(jSellOrders, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jEscrows, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jEscrowsToCover, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jManufacturing, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jContractCollateral, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jContractValue, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jOwnersSeparator, 3, 3, 3)
                    .addComponent(jAllProfiles, Program.getButtonsHeight(), Program.getButtonsHeight(),
                            Program.getButtonsHeight())
                    .addComponent(jOwnersScroll, 70, 70, Integer.MAX_VALUE)));
}

From source file:com.jtstand.swing.StatsPanel.java

public JFreeChart getChartValues(Iterator<TestStepInstance> values) {
    if (values == null || !values.hasNext()) {
        return null;
    }/* www .  j  a  va  2  s .c o  m*/

    XYSeriesCollection dataset = new XYSeriesCollection();
    int count = 0;
    TreeMap<String, XYSeries> map = new TreeMap<String, XYSeries>();
    while (values.hasNext()) {
        TestStepInstance step = values.next();
        Number num = getNumber(step);
        if (num != null) {
            String groupName = getGroupName(step);
            XYSeries pop = map.get(groupName);
            if (pop == null) {
                pop = new XYSeries(groupName);
                map.put(groupName, pop);
            }

            pop.add(++count, num.doubleValue());
        }

    }
    for (Iterator<XYSeries> it = map.values().iterator(); it.hasNext();) {
        dataset.addSeries(it.next());
    }

    //        NumberAxis xAxis = new NumberAxis("#");
    NumberAxis xAxis = new NumberAxis();
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(getValueString());
    yAxis.setAutoRangeIncludesZero(false);
    XYLineAndShapeRenderer renderer6 = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer6);
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setRangeCrosshairVisible(true);
    plot.setDomainCrosshairVisible(true);
    renderer6.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    renderer6.setBaseSeriesVisibleInLegend(false);

    //        StandardXYItemLabelGenerator itemlabels=new StandardXYItemLabelGenerator();
    //        renderer.setBaseItemLabelGenerator(itemlabels);
    //        renderer.setBaseItemLabelsVisible(true);

    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, isGrouping());
    //chart.setTitle(title);
    placeLimitMarkers(plot, true);
    /* coloring */
    if (isCategorization()) {
        //            TreeMap<String, Color> cmap = new TreeMap<String, Color>();
        int i = 0;
        for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) {
            String groupName = it.next();
            Color c = ChartCategories.getColor(i);
            for (int j = 0; j < dataset.getSeriesCount(); j++) {
                XYSeries s = dataset.getSeries(j);
                if (s.getKey().equals(groupName)) {
                    renderer6.setSeriesPaint(j, c);
                }
            }
        }
    } else {
        renderer6.setSeriesPaint(0, ChartCategories.getColor(0));
    }
    chart.setTextAntiAlias(false);
    return chart;
}

From source file:mil.tatrc.physiology.utilities.csv.plots.RespiratoryPFTPlotter.java

public void formatRPFTPlot(PlotJob job, JFreeChart chart) {
    XYPlot plot = (XYPlot) chart.getPlot();

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }/*from ww  w .  java  2 s .  c om*/
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);
}

From source file:mil.tatrc.physiology.utilities.csv.plots.MultiPlotter.java

protected void formatMultiPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1,
        XYSeriesCollection dataSet2) {/*w  w  w. j  a va 2s . c om*/
    Color[] blueColors = { Color.blue, Color.cyan, new Color(0, 160, 255), new Color(0, 100, 255),
            new Color(0, 160, 255), new Color(14, 0, 145), new Color(70, 105, 150) };
    Color[] redColors = { Color.red, Color.magenta, new Color(255, 0, 100), new Color(255, 0, 160), Color.pink,
            new Color(145, 0, 0), new Color(132, 58, 58) };
    Color[] variedColors = { Color.red, Color.blue, Color.green, Color.orange, Color.magenta, Color.cyan,
            Color.gray, new Color(255, 165, 0), new Color(42, 183, 136), new Color(87, 158, 186) };
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(2.0f);

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);

    //If there is only one Y axis, we just need to color the data series differently
    if (job.Y2headers == null || job.Y2headers.isEmpty()) {
        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 9)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, variedColors[cIndex]);
            renderer1.setSeriesPaint(i, variedColors[cIndex]);
        }
    }
    //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing
    else {
        StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
        plot.setRenderer(1, renderer2);

        for (int i = 0, cIndex = 0; i < dataSet1.getSeriesCount(); i++, cIndex++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer1.setSeriesFillPaint(i, redColors[cIndex]);
            renderer1.setSeriesPaint(i, redColors[cIndex]);
        }
        for (int i = 0, cIndex = 0; i < dataSet2.getSeriesCount(); i++, cIndex++) {
            renderer2.setSeriesStroke(i, wideLine);
            renderer2.setBaseShapesVisible(false);
            if (cIndex > 6)
                cIndex = 0;
            renderer2.setSeriesFillPaint(i, blueColors[cIndex]);
            renderer2.setSeriesPaint(i, blueColors[cIndex]);
        }
        plot.getRangeAxis(0).setLabelPaint(redColors[0]);
        plot.getRangeAxis(0).setTickLabelPaint(redColors[0]);
        plot.getRangeAxis(1).setLabelPaint(blueColors[0]);
        plot.getRangeAxis(1).setTickLabelPaint(blueColors[0]);
    }
}

From source file:mil.tatrc.physiology.utilities.csv.plots.ConvexHullPlotter.java

protected void formatConvexHullPlot(PlotJob job, JFreeChart chart, XYSeriesCollection dataSet1,
        XYSeriesCollection dataSet2) {//  w  w w  . j  a v  a  2s  .c  o m
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer1 = (XYLineAndShapeRenderer) plot.getRenderer();
    BasicStroke wideLine = new BasicStroke(2.0f);

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);

    //If there is only one Y axis, color all datasets red (so top, bottom, left, and right will be the same)
    if (job.Y2headers == null || job.Y2headers.isEmpty()) {
        for (int i = 0; i < dataSet1.getSeriesCount(); i++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            renderer1.setSeriesFillPaint(i, Color.red);
            renderer1.setSeriesPaint(i, Color.red);
            if (dataSet1.getSeries(i).getKey() != null
                    && dataSet1.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE"))
                renderer1.setSeriesVisibleInLegend(i, false);
        }
    }
    //If there are 2 Y axes, we should color the axes to correspond with the data so it isn't (as) confusing
    else {
        StandardXYItemRenderer renderer2 = new StandardXYItemRenderer();
        plot.setRenderer(1, renderer2);

        for (int i = 0; i < dataSet1.getSeriesCount(); i++) {
            renderer1.setSeriesStroke(i, wideLine);
            renderer1.setBaseShapesVisible(false);
            renderer1.setSeriesFillPaint(i, Color.red);
            renderer1.setSeriesPaint(i, Color.red);
            if (dataSet1.getSeries(i).getKey() != null
                    && dataSet1.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE"))
                renderer1.setSeriesVisibleInLegend(i, false);
        }
        for (int i = 0; i < dataSet2.getSeriesCount(); i++) {
            renderer2.setSeriesStroke(i, wideLine);
            renderer2.setBaseShapesVisible(false);
            renderer2.setSeriesFillPaint(i, Color.blue);
            renderer2.setSeriesPaint(i, Color.blue);
            if (dataSet2.getSeries(i).getKey() != null
                    && dataSet2.getSeries(i).getKey().toString().equalsIgnoreCase("REMOVE"))
                renderer2.setSeriesVisibleInLegend(i, false);
        }
        plot.getRangeAxis(0).setLabelPaint(Color.red);
        plot.getRangeAxis(0).setTickLabelPaint(Color.red);
        plot.getRangeAxis(1).setLabelPaint(Color.blue);
        plot.getRangeAxis(1).setTickLabelPaint(Color.blue);
    }
}

From source file:mil.tatrc.physiology.utilities.csv.plots.ActionEventPlotter.java

public void formatAEPlot(PlotJob job, JFreeChart chart) {
    XYPlot plot = (XYPlot) chart.getPlot();

    //For Scientific notation
    NumberFormat formatter = new DecimalFormat("0.######E0");

    for (int i = 0; i < plot.getDomainAxisCount(); i++) {
        plot.getDomainAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getDomainAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getDomainAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getDomainAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
    }//ww  w .j a  v a 2  s  . c  om
    for (int i = 0; i < plot.getRangeAxisCount(); i++) {
        plot.getRangeAxis(i).setLabelFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
        plot.getRangeAxis(i).setTickLabelFont(new Font("SansSerif", Font.PLAIN, 15));
        plot.getRangeAxis(i).setLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        plot.getRangeAxis(i).setTickLabelPaint(job.bgColor == Color.red ? Color.white : Color.black);
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(i);
        rangeAxis.setNumberFormatOverride(formatter);
    }

    //White background outside of plottable area
    chart.setBackgroundPaint(job.bgColor);

    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    chart.getLegend().setItemFont(new Font("SansSerif", Font.PLAIN, 15));
    chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, job.fontSize));
    chart.getTitle().setPaint(job.bgColor == Color.red ? Color.white : Color.black);
}

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Build content for animationType StatisticGrafic.ANIMATION_TimeValueDiagram
 * @return/*from ww w  .j  a  v a 2 s.  c  o  m*/
 * @throws ModelException
 */
private JPanel buildTimeValueDiagramPanel() throws ModelException {
    JPanel out = null;
    XYPlot plot = null;
    switch (this.statistic.getTypeData()) {
    case Statistic.DATA_Observations:
        XYSeriesCollection dataset1 = new XYSeriesCollection();
        dataset1.addSeries(this.statistic.getObservationSerie());
        this.chart = ChartFactory.createScatterPlot(null, "Time", null, dataset1, PlotOrientation.VERTICAL,
                false, true, false);
        this.chart.setBackgroundPaint(Grafic.COLOR_BACKGROUND);
        plot = this.chart.getXYPlot();
        break;
    case Statistic.DATA_TimeSeries:
        TimeSeriesCollection dataset2 = new TimeSeriesCollection();
        dataset2.addSeries(this.statistic.getTimeSerie());
        this.chart = ChartFactory.createXYStepChart(null, "Time", null, dataset2, PlotOrientation.VERTICAL,
                false, true, false);
        this.chart.setBackgroundPaint(Grafic.COLOR_BACKGROUND);
        plot = this.chart.getXYPlot();
        break;
    }
    if (plot != null) {
        plot.setBackgroundPaint(StatisticGrafic.DIAGRAM_BACKGROUND);
        plot.setDomainGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
        plot.setRangeGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
        plot.setDomainCrosshairVisible(true);
        plot.setRangeCrosshairVisible(true);
        String rangeAxisLabel = "";
        switch (statistic.getTypeIndex()) {
        case Statistic.INDEX_Min_Max:
            rangeAxisLabel = "min - max";
            break;
        case Statistic.INDEX_Mean_StdDev:
            rangeAxisLabel = "\u03BC-\u03C3 - mean - \u03BC+\u03C3";
            break;
        }
        //this.buildTimeValueDiagramAxisFormat(plot, rangeAxisLabel);
        plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f));
        plot.getRenderer().setSeriesPaint(0, StatisticGrafic.DIAGRAM_FORGROUND);

    }
    out = new ChartPanel(chart);
    out.setPreferredSize(new Dimension(350, 200));
    return out;
}

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartHelper.java

/***********************************************************************************************
 * Create a simple Chart from the specified XYDataset.
 * Choose a TimeSeriesChart or a XYLineChart appropriately.
 * Called from createCustomisedChart() in each ChartUIComponent subclass.
 *
 *
 * @param dataset//w w  w. j  av a2s  . com
 * @param timezone
 * @param metadatalist
 * @param channelcount
 * @param temperaturechannel
 * @param updatetype
 * @param displaylimit
 * @param channelselector
 * @param debug
 *
 * @return JFreeChart
 */

public static JFreeChart createChart(final XYDataset dataset, final TimeZone timezone,
        final List<Metadata> metadatalist, final int channelcount, final boolean temperaturechannel,
        final DataUpdateType updatetype, final int displaylimit,
        final ChannelSelectorUIComponentInterface channelselector, final boolean debug) {
    final String SOURCE = "ChartHelper.createChart() ";
    final JFreeChart chart;
    final String strTitle;
    final String strLabelX;
    final String strLabelY;
    final XYDataset xyDatasetToDisplay;

    // The set of Metadata available should include the Instrument
    // and any items from the current observation
    strTitle = MetadataHelper.getMetadataValueByKey(metadatalist,
            MetadataDictionary.KEY_OBSERVATION_TITLE.getKey());
    strLabelX = MetadataHelper.getMetadataValueByKey(metadatalist,
            MetadataDictionary.KEY_OBSERVATION_AXIS_LABEL_X.getKey());
    // Axis.Y.0 only in this version
    strLabelY = MetadataHelper.getMetadataValueByKey(metadatalist,
            MetadataDictionary.KEY_OBSERVATION_AXIS_LABEL_Y.getKey() + MetadataDictionary.SUFFIX_SERIES_ZERO);

    // Transform the XYdataset in accordance with the current ChannelSelection Mode before displaying

    channelselector.debugSelector(debug, SOURCE);

    xyDatasetToDisplay = copyTransformedXYDataset(dataset, timezone, updatetype, displaylimit,
            channelselector.isDecimating(), channelselector.getChannelSelectionModes());
    if (dataset instanceof TimeSeriesCollection) {
        chart = ChartFactory.createTimeSeriesChart(strTitle, strLabelX, strLabelY, xyDatasetToDisplay,
                channelselector.hasLegend(), true, false);
    } else {
        chart = ChartFactory.createXYLineChart(strTitle, strLabelX, strLabelY, xyDatasetToDisplay,
                PlotOrientation.VERTICAL, channelselector.hasLegend(), true, false);
    }

    if ((chart != null) && (chart.getXYPlot() != null) && (chart.getXYPlot().getRangeAxis() != null)) {
        final Stroke strokeCrosshair;
        final XYPlot plot;
        final XYItemRenderer renderer;

        chart.setBackgroundPaint(UIComponentPlugin.DEFAULT_COLOUR_CANVAS.getColor());

        // Experimental chart configuration
        chart.getTitle().setFont(UIComponentPlugin.DEFAULT_FONT.getFont().deriveFont(20.0f));

        plot = chart.getXYPlot();
        plot.setBackgroundPaint(COLOR_PLOT);
        plot.setDomainGridlinePaint(COLOR_GRIDLINES);
        plot.setRangeGridlinePaint(COLOR_GRIDLINES);
        plot.setAxisOffset(PLOT_RECTANGLE_INSETS);

        plot.setDomainCrosshairVisible(true);
        plot.setDomainCrosshairLockedOnData(false);
        plot.setRangeCrosshairVisible(false);

        // Make the Crosshair more visible by changing the width from the default
        strokeCrosshair = new BasicStroke(2.0f, // The width of this BasicStroke
                BasicStroke.CAP_BUTT, // The decoration of the ends of a BasicStroke
                BasicStroke.JOIN_BEVEL, // The decoration applied where path segments meet
                0.0f, // The limit to trim the miter join
                new float[] { 2.0f, 2.0f }, // The array representing the dashing pattern
                0.0f); // The offset to start the dashing pattern
        plot.setDomainCrosshairStroke(strokeCrosshair);

        renderer = plot.getRenderer();

        if ((renderer != null) && (renderer instanceof XYLineAndShapeRenderer)) {
            final XYLineAndShapeRenderer xyItemRenderer;
            int intSeriesCount;

            xyItemRenderer = (XYLineAndShapeRenderer) renderer;

            xyItemRenderer.setBaseLinesVisible(true);
            xyItemRenderer.setBaseShapesVisible(false);
            xyItemRenderer.setBaseShapesFilled(true);
            xyItemRenderer.setItemLabelsVisible(true);

            // Set the shape for the Chart legend items
            ChartUIHelper.setLegendShape(xyItemRenderer);

            // Colour only as many Series as we know about
            intSeriesCount = 0;

            // Examine the state of each channel's selection
            for (int channel = 0; channel < channelcount; channel++) {
                final ChannelSelectionMode selectionMode;

                if ((channelselector.getChannelSelectionModes() != null)
                        && (channelselector.getChannelSelectionModes().size() == channelcount)) {
                    // If there is a ChannelSelector, get the gain setting, or OFF
                    selectionMode = channelselector.getChannelSelectionModes().get(channel);
                } else if (!channelselector.showChannels()) {
                    // If there is no ChannelSelector, we assume that all Channels are ON, at X1
                    selectionMode = ChannelSelectionMode.X1;
                } else {
                    // Not sure what to do, so just show all
                    selectionMode = ChannelSelectionMode.X1;
                }

                if (!ChannelSelectionMode.OFF.equals(selectionMode)) {
                    final ColourInterface colour;

                    colour = MetadataHelper.getChannelColour(metadatalist, channel, temperaturechannel);

                    MetadataHelper.showMetadataList(metadatalist, SOURCE + " COLOURS FOR CHART",
                            LOADER_PROPERTIES.isMetadataDebug());

                    if (colour != null) {
                        // Map the Colour to the Series
                        xyItemRenderer.setSeriesPaint(intSeriesCount, colour.getColor());
                    } else {
                        // Use the default colour if the metadata doesn't have it
                        LOGGER.error(SOURCE
                                + "The channel colour was missing or incorrectly specified in the Metadata, using default colour"
                                + " [channel=" + channel + "]");
                        xyItemRenderer.setSeriesPaint(intSeriesCount,
                                ChartUIHelper.getStandardColour(channel).getColor());
                    }

                    // Prepare for the next Series
                    intSeriesCount++;
                }
            }
        }
    }

    return (chart);
}

From source file:CGgui.java

public void plotData() {

    int smoothParam;

    XYSeries xyseries = lengthHist;/*  w  w w  . ja  v  a2s.  c o  m*/
    histogramdataset = new XYSeriesCollection();

    if (lengthHist.getItemCount() > 0) {

        MIN = lengthHist.getMinX();
        MAX = lengthHist.getX((int) (2 * lengthHist.getItemCount() / 3)).doubleValue(); // 75th percentile

        if (smoothCheckBox.isSelected()) {

            if (smoothText.getText().length() == 0) {
                smoothParam = (int) (20 * (BINS / (MAX - MIN + 1)));
                smoothText.setText(Integer.toString(smoothParam));
            }

            smoothParam = Integer.parseInt(smoothText.getText());
            if (DEBUG)
                PrintText("Smoothing parameter:" + smoothParam + "\n");

            xyseries = MovingAverage(smoothParam);
        }

        // plotting
        XYPlot xyplot = (XYPlot) chart.getPlot();

        // adjust axes
        ValueAxis domainAxis = xyplot.getDomainAxis();
        domainAxis.setRange(MIN, MAX);

        // add data
        histogramdataset.addSeries(xyseries);
        xyplot.setDataset(histogramdataset);

        //turn on crosshairs
        xyplot.setDomainCrosshairVisible(true);
        xyplot.setDomainCrosshairLockedOnData(false);

    }

}

From source file:com.jtstand.swing.StatsPanel.java

public JFreeChart getChartTime() {
    TreeMap<String, List<TestStepInstance>> s = getGroupedSteps(getFilteringIterator());
    if (s == null || s.size() == 0) {
        return null;
    }/*from  w  w w.  j  a  va2s.  co  m*/
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    for (Iterator<String> en = s.keySet().iterator(); en.hasNext();) {
        String groupName = en.next();
        List<TestStepInstance> stps = s.get(groupName);
        //            TimeSeries pop = new TimeSeries(groupName, Millisecond.class);
        TimeSeries pop = new TimeSeries(groupName);
        for (Iterator<TestStepInstance> it = stps.iterator(); it.hasNext();) {
            TestStepInstance step = it.next();
            Number num = getNumber(step);
            if (num != null) {
                switch (chartMode) {
                case STEP_TIME:
                    pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class,
                            new Date(step.getStartTime()), TimeZone.getDefault()), num);
                    break;
                case SEQUENCE_TIME:
                    //                            pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class, new Date(step.getTestSequenceInstance().getStartTime()), RegularTimePeriod.DEFAULT_TIME_ZONE), num);
                    pop.addOrUpdate(RegularTimePeriod.createInstance(Millisecond.class,
                            new Date(step.getTestSequenceInstance().getCreateTime()), TimeZone.getDefault()),
                            num);
                    break;
                }
            }
        }
        dataset.addSeries(pop);
    }
    JFreeChart chart = null;
    switch (chartMode) {
    case STEP_TIME:
        chart = ChartFactory.createTimeSeriesChart(null, "Step Started Time", getValueString(), dataset,
                isGrouping(), true, false);
        break;
    case SEQUENCE_TIME:
        chart = ChartFactory.createTimeSeriesChart(null, "Sequence Started Time", getValueString(), dataset,
                isGrouping(), true, false);
        break;
    }
    chart.setBackgroundPaint((Paint) UIManager.get("Panel.background"));

    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.white);
    XYLineAndShapeRenderer renderer5 = new XYLineAndShapeRenderer();
    renderer5.setBaseSeriesVisibleInLegend(false);
    plot.setRenderer(renderer5);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.setDomainCrosshairVisible(true);
    //        chart.setTitle(valueName);
    placeLimitMarkers(plot, true);

    //renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    renderer5.setBaseToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance());

    /* coloring */
    if (isCategorization()) {
        //            TreeMap<String, Color> cmap = new TreeMap<String, Color>();
        int i = 0;
        for (Iterator<String> it = catstats.keySet().iterator(); it.hasNext(); i++) {
            String groupName = it.next();
            Color c = ChartCategories.getColor(i);
            for (int j = 0; j < dataset.getSeriesCount(); j++) {
                TimeSeries ts = dataset.getSeries(j);
                if (ts.getKey().equals(groupName)) {
                    renderer5.setSeriesPaint(j, c);
                }
            }
        }
    } else {
        renderer5.setSeriesPaint(0, ChartCategories.getColor(0));
    }

    //        chart.addProgressListener(new ChartProgressListener() {
    //
    //            public void chartProgress(final ChartProgressEvent progress) {
    //                SwingUtilities.invokeLater(
    //                        new Runnable() {
    //
    //                            @Override
    //                            public void run() {
    //
    //                                System.out.println("progress:" + progress + " " + progress.getType());
    //                                if (progress.getType() == ChartProgressEvent.DRAWING_FINISHED) {
    //                                    if (plot != null) {
    //                                        if (plot.isDomainCrosshairVisible() && plot.isDomainCrosshairLockedOnData()) {
    ////                            System.out.println("getDomainCrosshairValue:" + plot.getDomainCrosshairValue());
    //                                            double xx = plot.getDomainCrosshairValue();
    //                                            if (xx != 0.0) {
    //                                                long x = (long) xx;
    //                                                System.out.println(new Date(x));
    //                                                for (TestStepInstance step : testStepInstances.getSteps()) {
    //                                                    if (step.getStartTime() != null && step.getStartTime().equals(x)) {
    //                                                        testStepInstances.selectStep(step);
    //                                                    }
    //                                                }
    //                                                System.out.println(new Date(x));
    //                                            }
    //                                        }
    ////                        if (plot.isRangeCrosshairVisible()) {
    ////                            System.out.println("getRangeCrosshairValue:" + plot.getRangeCrosshairValue());
    ////                        }
    //                                    }
    //                                }
    //                            }
    //                        });
    //            }
    //        });

    //        chart.addChangeListener(new ChartChangeListener() {
    //
    //            public void chartChanged(ChartChangeEvent event) {
    //                System.out.println("event:" + event);
    //                if (event != null) {
    ////                    JFreeChart chart = event.getChart();
    ////                    System.out.println("chart:" + chart);
    ////                    if (chart != null) {
    ////                        System.out.println("title:" + event.getChart().getTitle());
    ////                    }
    //                    System.out.println("type:" + event.getType());
    //                    if (plot != null) {
    //                        if (plot.isDomainCrosshairVisible()) {
    //                            System.out.println("getDomainCrosshairValue:" + plot.getDomainCrosshairValue());
    //                            long x = (long) plot.getDomainCrosshairValue();
    //                            for (TestStepInstance step : testStepInstances.getSteps()) {
    //                                if (step.getStartTime() != null && step.getStartTime().equals(x)) {
    //                                    testStepInstances.selectStep(step);
    //                                }
    //                            }
    //                            System.out.println(new Date(x));
    //                        }
    //                        if (plot.isRangeCrosshairVisible()) {
    //                            System.out.println("getRangeCrosshairValue:" + plot.getRangeCrosshairValue());
    //                        }
    //                    }
    //                }
    //            }
    //        });
    chart.setTextAntiAlias(false);
    return chart;
}