Examples of XYChart


Examples of ChartDirector.XYChart

    /// Draw the chart and display it in the given viewer.
    /// </summary>
    private void drawChart(ChartViewer viewer) {
        // Create an XYChart object 600 x 270 pixels in size, with light grey (f4f4f4)
        // background, black (000000) border, 1 pixel raised effect, and with a rounded frame.
        XYChart c = new XYChart(600, 270, 0xf4f4f4, 0x000000, 1);
        c.setRoundedFrame();

        // Re-cycle the resources of the existing chart, if any. This can improve performance
        // by reducing the frequency of garbage collections.
        c.recycle(chartViewer1.getChart());

        // Set the plotarea at (55, 62) and of size 520 x 175 pixels. Use white (ffffff)
        // background. Enable both horizontal and vertical grids by setting their colors to
        // grey (cccccc). Set clipping mode to clip the data lines to the plot area.
        c.setPlotArea(55, 62, 520, 175, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
        c.setClipping();

        // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
        // grey (dddddd) background, black (000000) border, and a glass like raised effect.
        c.addTitle("Realtime Chart Demonstration", "Times New Roman Bold Italic", 15).setBackground(0xdddddd, 0x000000, Chart.glassEffect());

        // Add a legend box at the top of the plot area with 9pts Arial Bold font. We set the
        // legend box to the same width as the plot area and use grid layout (as opposed to
        // flow or top/down layout). This distributes the 3 legend icons evenly on top of the
        // plot area.
        LegendBox b = c.addLegend2(55, 33, 3, "Arial Bold", 9);
        b.setBackground(Chart.Transparent, Chart.Transparent);
        b.setWidth(520);

        // Configure the y-axis with a 10pts Arial Bold axis title
        c.yAxis().setTitle("Price (USD)", "Arial Bold", 10);

        // Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15
        // pixels between minor ticks. This shows more minor grid lines on the chart.
        c.xAxis().setTickDensity(75, 15);

        // Set the axes width to 2 pixels
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);

        // Now we add the data to the chart
        Date lastTime = timeStamps[timeStamps.length - 1];
        if (lastTime != null) {
            // Set up the x-axis to show the time range in the data buffer
            c.xAxis().setDateScale(
                    new Date(lastTime.getTime() - dataInterval * timeStamps.length), lastTime);

            // Set the x-axis label format
            c.xAxis().setLabelFormat("{value|hh:nn:ss}");

            // Create a line layer to plot the lines
            LineLayer layer = c.addLineLayer2();

            // The x-coordinates are the timeStamps.
            layer.setXData(timeStamps);

            // The 3 data series are used to draw 3 lines. Here we put the latest data
            // values as part of the data set name, so you can see them updated in the
            // legend box.
            layer.addDataSet(dataSeriesA, 0xff0000, "Software: <*bgColor=FFCCCC*>"
                    + c.formatValue(dataSeriesA[dataSeriesA.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesB, 0x00cc00, "Hardware: <*bgColor=CCFFCC*>"
                    + c.formatValue(dataSeriesB[dataSeriesB.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesC, 0x0000ff, "Services: <*bgColor=CCCCFF*>"
                    + c.formatValue(dataSeriesC[dataSeriesC.length - 1], " {value|2} "));

            //
            // To show the capabilities of ChartDirector, we are add a movable threshold
            // line to the chart and dynamically print a warning message on the chart if
            // a data value exceeds the threshold
            //

            // Add a red mark line to the chart, with the mark label shown at the left of
            // the mark line.
            double thresholdValue = Double.parseDouble(alarmThreshold.getText());
            Mark m = c.yAxis().addMark(thresholdValue, 0xff0000, "Alarm = " + thresholdValue);
            m.setAlignment(Chart.Left);
            m.setBackground(0xffcccc);

            if ((dataSeriesC[dataSeriesC.length - 1] > thresholdValue)
                    || (dataSeriesB[dataSeriesB.length - 1] > thresholdValue)) {
                // Add an alarm message as a custom text box on top-right corner of the
                // plot area if the latest data value exceeds threshold.
                c.addText(575, 62, "Alarm - Latest Value Exceeded Threshold",
                        "Arial Bold Italic", 10, 0xffffff, Chart.TopRight).setBackground(0xdd0000);
            }

            // Fill the region above the threshold as semi-transparent red (80ff8888)
            c.addInterLineLayer(layer.getLine(1), m.getLine(), 0x80ff8888, Chart.Transparent);
            c.addInterLineLayer(layer.getLine(2), m.getLine(), 0x80ff8888, Chart.Transparent);
        }

        // Set the chart image to the ChartViewer
        chartViewer1.setChart(c);
    }
View Full Code Here

Examples of ChartDirector.XYChart

    /// Draw the chart and display it in the given viewer.
    /// </summary>
    private void drawChart(ChartViewer viewer) {
        // Create an XYChart object 600 x 270 pixels in size, with light grey (f4f4f4)
        // background, black (000000) border, 1 pixel raised effect, and with a rounded frame.
        XYChart c = new XYChart(600, 270, 0xf4f4f4, 0x000000, 1);
        c.setRoundedFrame();

        // Re-cycle the resources of the existing chart, if any. This can improve performance
        // by reducing the frequency of garbage collections.
        c.recycle(chartViewer1.getChart());

        // Set the plotarea at (55, 62) and of size 520 x 175 pixels. Use white (ffffff)
        // background. Enable both horizontal and vertical grids by setting their colors to
        // grey (cccccc). Set clipping mode to clip the data lines to the plot area.
        c.setPlotArea(55, 62, 520, 175, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
        c.setClipping();

        // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
        // grey (dddddd) background, black (000000) border, and a glass like raised effect.
        c.addTitle("Realtime Chart Demonstration", "Times New Roman Bold Italic", 15).setBackground(0xdddddd, 0x000000, Chart.glassEffect());

        // Add a legend box at the top of the plot area with 9pts Arial Bold font. We set the
        // legend box to the same width as the plot area and use grid layout (as opposed to
        // flow or top/down layout). This distributes the 3 legend icons evenly on top of the
        // plot area.
        LegendBox b = c.addLegend2(55, 33, 3, "Arial Bold", 9);
        b.setBackground(Chart.Transparent, Chart.Transparent);
        b.setWidth(520);

        // Configure the y-axis with a 10pts Arial Bold axis title
        c.yAxis().setTitle("Price (USD)", "Arial Bold", 10);

        // Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15
        // pixels between minor ticks. This shows more minor grid lines on the chart.
        c.xAxis().setTickDensity(75, 15);

        // Set the axes width to 2 pixels
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);

        // Now we add the data to the chart
        Date lastTime = timeStamps[timeStamps.length - 1];
        if (lastTime != null) {
            // Set up the x-axis to show the time range in the data buffer
            c.xAxis().setDateScale(
                    new Date(lastTime.getTime() - dataInterval * timeStamps.length), lastTime);

            // Set the x-axis label format
            c.xAxis().setLabelFormat("{value|hh:nn:ss}");

            // Create a line layer to plot the lines
            LineLayer layer = c.addLineLayer2();

            // The x-coordinates are the timeStamps.
            layer.setXData(timeStamps);

            // The 3 data series are used to draw 3 lines. Here we put the latest data
            // values as part of the data set name, so you can see them updated in the
            // legend box.
            layer.addDataSet(dataSeriesA, 0xff0000, "Software: <*bgColor=FFCCCC*>"
                    + c.formatValue(dataSeriesA[dataSeriesA.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesB, 0x00cc00, "Hardware: <*bgColor=CCFFCC*>"
                    + c.formatValue(dataSeriesB[dataSeriesB.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesC, 0x0000ff, "Services: <*bgColor=CCCCFF*>"
                    + c.formatValue(dataSeriesC[dataSeriesC.length - 1], " {value|2} "));

            //
            // To show the capabilities of ChartDirector, we are add a movable threshold
            // line to the chart and dynamically print a warning message on the chart if
            // a data value exceeds the threshold
            //

            // Add a red mark line to the chart, with the mark label shown at the left of
            // the mark line.
            double thresholdValue = Double.parseDouble(alarmThreshold.getText());
            Mark m = c.yAxis().addMark(thresholdValue, 0xff0000, "Alarm = " + thresholdValue);
            m.setAlignment(Chart.Left);
            m.setBackground(0xffcccc);

            if ((dataSeriesC[dataSeriesC.length - 1] > thresholdValue)
                    || (dataSeriesB[dataSeriesB.length - 1] > thresholdValue)) {
                // Add an alarm message as a custom text box on top-right corner of the
                // plot area if the latest data value exceeds threshold.
                c.addText(575, 62, "Alarm - Latest Value Exceeded Threshold",
                        "Arial Bold Italic", 10, 0xffffff, Chart.TopRight).setBackground(0xdd0000);
            }

            // Fill the region above the threshold as semi-transparent red (80ff8888)
            c.addInterLineLayer(layer.getLine(1), m.getLine(), 0x80ff8888, Chart.Transparent);
            c.addInterLineLayer(layer.getLine(2), m.getLine(), 0x80ff8888, Chart.Transparent);
        }

        // Set the chart image to the ChartViewer
        chartViewer1.setChart(c);
    }
View Full Code Here

Examples of ChartDirector.XYChart

    /// Draw the chart and display it in the given viewer.
    /// </summary>
    private void drawChart(ChartViewer viewer) {
        // Create an XYChart object 600 x 270 pixels in size, with light grey (f4f4f4)
        // background, black (000000) border, 1 pixel raised effect, and with a rounded frame.
        XYChart c = new XYChart(600, 270, 0xf4f4f4, 0x000000, 1);
        c.setRoundedFrame();

        // Re-cycle the resources of the existing chart, if any. This can improve performance
        // by reducing the frequency of garbage collections.
        c.recycle(chartViewer1.getChart());

        // Set the plotarea at (55, 62) and of size 520 x 175 pixels. Use white (ffffff)
        // background. Enable both horizontal and vertical grids by setting their colors to
        // grey (cccccc). Set clipping mode to clip the data lines to the plot area.
        c.setPlotArea(55, 62, 520, 175, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
        c.setClipping();

        // Add a title to the chart using 15 pts Times New Roman Bold Italic font, with a light
        // grey (dddddd) background, black (000000) border, and a glass like raised effect.
        c.addTitle("Realtime Chart Demonstration", "Times New Roman Bold Italic", 15).setBackground(0xdddddd, 0x000000, Chart.glassEffect());

        // Add a legend box at the top of the plot area with 9pts Arial Bold font. We set the
        // legend box to the same width as the plot area and use grid layout (as opposed to
        // flow or top/down layout). This distributes the 3 legend icons evenly on top of the
        // plot area.
        LegendBox b = c.addLegend2(55, 33, 3, "Arial Bold", 9);
        b.setBackground(Chart.Transparent, Chart.Transparent);
        b.setWidth(520);

        // Configure the y-axis with a 10pts Arial Bold axis title
        c.yAxis().setTitle("Price (USD)", "Arial Bold", 10);

        // Configure the x-axis to auto-scale with at least 75 pixels between major tick and 15
        // pixels between minor ticks. This shows more minor grid lines on the chart.
        c.xAxis().setTickDensity(75, 15);

        // Set the axes width to 2 pixels
        c.xAxis().setWidth(2);
        c.yAxis().setWidth(2);

        // Now we add the data to the chart
        Date lastTime = timeStamps[timeStamps.length - 1];
        if (lastTime != null) {
            // Set up the x-axis to show the time range in the data buffer
            c.xAxis().setDateScale(
                    new Date(lastTime.getTime() - dataInterval * timeStamps.length), lastTime);

            // Set the x-axis label format
            c.xAxis().setLabelFormat("{value|hh:nn:ss}");

            // Create a line layer to plot the lines
            LineLayer layer = c.addLineLayer2();

            // The x-coordinates are the timeStamps.
            layer.setXData(timeStamps);

            // The 3 data series are used to draw 3 lines. Here we put the latest data
            // values as part of the data set name, so you can see them updated in the
            // legend box.
            layer.addDataSet(dataSeriesA, 0xff0000, "Software: <*bgColor=FFCCCC*>"
                    + c.formatValue(dataSeriesA[dataSeriesA.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesB, 0x00cc00, "Hardware: <*bgColor=CCFFCC*>"
                    + c.formatValue(dataSeriesB[dataSeriesB.length - 1], " {value|2} "));
            layer.addDataSet(dataSeriesC, 0x0000ff, "Services: <*bgColor=CCCCFF*>"
                    + c.formatValue(dataSeriesC[dataSeriesC.length - 1], " {value|2} "));

            //
            // To show the capabilities of ChartDirector, we are add a movable threshold
            // line to the chart and dynamically print a warning message on the chart if
            // a data value exceeds the threshold
            //

            // Add a red mark line to the chart, with the mark label shown at the left of
            // the mark line.
            double thresholdValue = Double.parseDouble(alarmThreshold.getText());
            Mark m = c.yAxis().addMark(thresholdValue, 0xff0000, "Alarm = " + thresholdValue);
            m.setAlignment(Chart.Left);
            m.setBackground(0xffcccc);

            if ((dataSeriesC[dataSeriesC.length - 1] > thresholdValue)
                    || (dataSeriesB[dataSeriesB.length - 1] > thresholdValue)) {
                // Add an alarm message as a custom text box on top-right corner of the
                // plot area if the latest data value exceeds threshold.
                c.addText(575, 62, "Alarm - Latest Value Exceeded Threshold",
                        "Arial Bold Italic", 10, 0xffffff, Chart.TopRight).setBackground(0xdd0000);
            }

            // Fill the region above the threshold as semi-transparent red (80ff8888)
            c.addInterLineLayer(layer.getLine(1), m.getLine(), 0x80ff8888, Chart.Transparent);
            c.addInterLineLayer(layer.getLine(2), m.getLine(), 0x80ff8888, Chart.Transparent);
        }

        // Set the chart image to the ChartViewer
        chartViewer1.setChart(c);
    }
View Full Code Here

Examples of org.magicbox.chart.XYChart

public class GraphController extends AbstractController {

    protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {

        Dataset storico = (Dataset) req.getAttribute(Constant.SPEDIZIONE);
        XYChart chart = new XYChart(new SpedizioneCriteria());
        Map<Object, Object> model = new FastMap<Object, Object>();
        model.put(Constant.GRAFICO, chart.getGraph());
        return new ModelAndView(new PngView(), model);
        // return null;
    }
View Full Code Here

Examples of systole.view.charts.XYChart

    }

    private void calculate() {
        if ((this.currentAnalysis.getSelectedSegments() != null) && (this.currentAnalysis.getFinalSegment() != null)) {

            this.allCharts = new XYChart("Segmentos", "Muestras", "Amplitud (%)");

            Iterator<SelectedSegment> segments = this.currentAnalysis.getSelectedSegments().iterator();
            while (segments.hasNext()) {
                SelectedSegment selectedSegment = segments.next();
                this.allCharts.addSeries("Seg-" + (selectedSegment.getNumber() + 1), selectedSegment.getSegment().toDoubleArray(), 1);
                SelectionItem selectItem = this.selectionItems.get(selectedSegment.getNumber());
                if (selectItem != null) {
                    selectItem.setSelected(true);
                }
            }

            double frequency = this.currentAnalysis.getSignalFrequency().getFrequency().doubleValue();
            this.finalSegment = new XYChart("Curva Final", "Tiempo (ms)", "Amplitud (%)");
            this.finalSegment.addSeries("Latido", this.currentAnalysis.getFinalSegment().getFinalSegment().toDoubleArray(), frequency);

            this.derivates = new XYChart("Derivadas", "Tiempo (ms)", "Amplitud (%)");
            this.derivates.addSeries("Latido", this.currentAnalysis.getFinalSegment().getFinalSegment().toDoubleArray(), frequency);
            this.derivates.addSeries("Derivada 1ra", this.currentAnalysis.getFinalSegment().getFirstDerivatite().toDoubleArray(), frequency);
            this.derivates.addSeries("Derivada 2da", this.currentAnalysis.getFinalSegment().getSecondDerivative().toDoubleArray(), frequency);
            this.derivates.addSeries("Derivada 3ra", this.currentAnalysis.getFinalSegment().getThirdDerivative().toDoubleArray(), frequency);
            this.derivates.addSeries("Derivada 4ta", this.currentAnalysis.getFinalSegment().getFourthDerivative().toDoubleArray(), frequency);
View Full Code Here

Examples of systole.view.charts.XYChart

    }

    private void report() {
        if ((this.currentAnalysis != null) && (this.currentAnalysis.getFinalSegment() != null)) {

            XYChart chart = new XYChart("Registro de Variación", "[ms]", "[%]");

            chart.addSeries("", this.currentAnalysis.getFinalSegment().getFinalSegment().toDoubleArray(), this.currentAnalysis.getSignalFrequency().getFrequency().doubleValue());
            chart.setShowLegend(false);
            chart.setShowTitle(false);

            this.reportPanel = chart.blackAndWhitePlot();
            this.reportPanel.setMaximumSize(new Dimension(400, 230));
            this.image = chart.plotThumbnail(280, 200, true);
            this.reportPanel.setMouseZoomable(false);
            this.reportPanel.setPopupMenu(null);
            this.reported = true;
        }
    }
View Full Code Here

Examples of systole.view.charts.XYChart

            FilterSettings filtSet = new FilterSettings();
            filtSet.createDefault(this.parentControl.getAnalysis().getSignalFrequency().getFrequency().doubleValue());
            RawSignal rawSignal = this.parentControl.getAnalysis().getRawSignal();

            // primer grafico -> señal cruda
            XYChart rawSignalXYChart = new XYChart("Señal Original", "Muestras", "Amplitud (%)");
            rawSignalXYChart.setShowLegend(false);
            rawSignalXYChart.addSeries("Tren de Pulsos", rawSignal.getSegment().toDoubleArray(), 1);
            this.rawSignalChart = rawSignalXYChart.plot();

            this.segment = FilterProcessor.filterPulseWave(rawSignal.getSegment(), filtSet);

            // Si fue tomada invertida, la invierto
            if (rawSignal.isInverted()) {
                this.segment = this.segment.invert();
            }

            // segundo grafico -> señal invertida y filtrada
            this.filteredSignalModel = new XYChart("Señal Filtrada", "Muestras", "Amplitud (%)");
            filteredSignalModel.setShowLegend(false);
            this.filteredSignalModel.addSeries("Tren de Pulsos", this.segment.toDoubleArray(), 1);
            this.filteredSignalChart = this.filteredSignalModel.plot();
        } catch (Exception e) {
            SystoleLogger.getInstance().logError(e.getMessage());
View Full Code Here

Examples of systole.view.charts.XYChart

        }
        return null;
    }

    private void doDerivatives(Segment segment) {
        this.derivates = new XYChart("Derivadas", "Tiempo (ms)", "Amplitud (%)");
        double frequency = this.currentAnalysis.getSignalFrequency().getFrequency().doubleValue();
        this.derivates.addSeries("Latido", segment.toDoubleArray(), frequency);
        this.derivates.addSeries("Derivada 1ra", finalSignal.getFirstDerivatite().toDoubleArray(), frequency);
        this.derivates.addSeries("Derivada 2da", finalSignal.getSecondDerivative().toDoubleArray(), frequency);
        this.derivates.addSeries("Derivada 3ra", finalSignal.getThirdDerivative().toDoubleArray(), frequency);
View Full Code Here

Examples of systole.view.charts.XYChart

        this.derivates.addSeries("Derivada 3ra", finalSignal.getThirdDerivative().toDoubleArray(), frequency);
        this.derivates.addSeries("Derivada 4ta", finalSignal.getFourthDerivative().toDoubleArray(), frequency);
    }

    private void doCharts(Segment segment) {
        this.allCharts = new XYChart("Segmentos", "Muestras", "Amplitud (%)");

        Iterator<SelectedSegment> segments = this.parentControl.getSelectionModel().getSelectedSegments().iterator();
        while (segments.hasNext()) {
            SelectedSegment selectedSegment = segments.next();
            this.allCharts.addSeries("Seg-" + (selectedSegment.getNumber() + 1), selectedSegment.getSegment().toDoubleArray(), 1);
        }

        this.finalSegment = new XYChart("Curva Final", "Tiempo (ms)", "Amplitud (%)");
        this.finalSegment.addSeries("Latido", segment.toDoubleArray(), this.currentAnalysis.getSignalFrequency().getFrequency().doubleValue());
    }
View Full Code Here

Examples of systole.view.charts.XYChart

    protected Void doInBackground() {
        try {
            ResultsModel modelResult = this.parentControl.getResultsModel();
            if ((modelResult != null) && (modelResult.getCurrentFinalSignal() != null)) {

                XYChart chart = new XYChart("Registro de Variación", "[ms]", "[%]");

                chart.addSeries("", modelResult.getCurrentFinalSignal().getFinalSegment().toDoubleArray(), this.parentControl.getAnalysis().getSignalFrequency().getFrequency().doubleValue());
                chart.setShowLegend(false);
                chart.setShowTitle(false);

                this.image = chart.plotThumbnail(280, 200, true);
                this.chartPanel = chart.blackAndWhitePlot();
                this.finished = true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.