Search in sources :

Example 1 with CategoryAxis

use of javafx.scene.chart.CategoryAxis in project Gargoyle by callakrsos.

the class SVNViewer method svnTreeViewOnAction.

public void svnTreeViewOnAction(SVNItem item) {
    if (!item.isDir()) {
        lastSelectedSVNItem.set(item);
        tbRevision.getItems().clear();
        LineChart<String, String> lineHist = new LineChart<>(new CategoryAxis(), new CategoryAxis());
        //			lineHist.setRotate(90d);
        //			lineHist.scaleXProperty().set(0.7);
        //			lineHist.scaleYProperty().set(0.7);
        lineHist.autosize();
        lineHist.setLegendVisible(false);
        List<SVNLogEntry> logs = item.getManager().log(item.getPath());
        tbRevision.getItems().addAll(logs.stream().sorted(sortUpper).collect(Collectors.toList()));
        // 시리즈 생성
        ObservableList<Data<String, String>> observableArrayList = FXCollections.observableArrayList();
        logs.stream().sorted(sortLower).forEach(entry -> {
            Date date = entry.getDate();
            String dateString = DateUtil.getDateString(date.getTime(), "yy-MM-dd HH:mm");
            Data<String, String> data = new Data<>(dateString, entry.getAuthor());
            setDataNode(entry, data);
            data.getNode().setOnMouseClicked(e -> {
                if (e.getClickCount() == 2 && e.getButton() == MouseButton.PRIMARY) {
                    String path = item.path;
                    long revision = entry.getRevision();
                    String content = item.getManager().cat(path, String.valueOf(revision));
                    BorderPane pane = new BorderPane(FxUtil.createJavaTextArea(content));
                    pane.setTop(new Label(item.getManager().fromPrettySVNLogConverter().apply(entry)));
                    FxUtil.showPopOver(data.getNode(), pane);
                }
            });
            data.getNode().setOnMouseEntered(ev -> {
                data.getNode().setBlendMode(BlendMode.GREEN);
            });
            data.getNode().setOnMouseExited(ev -> {
                data.getNode().setBlendMode(null);
            });
            observableArrayList.add(data);
        });
        Series<String, String> series = new Series<>("Commitors.", observableArrayList);
        lineHist.getData().add(series);
        borChart.setCenter(lineHist);
        String cat = item.getManager().cat(item.getPath());
        //			String simpleName = item.getSimpleName();
        javaTextAre.setContent(cat);
        tabPaneSVN.getSelectionModel().select(tabHistChart);
    }
}
Also used : BorderPane(javafx.scene.layout.BorderPane) SVNLogEntry(org.tmatesoft.svn.core.SVNLogEntry) Label(javafx.scene.control.Label) Data(javafx.scene.chart.XYChart.Data) Date(java.util.Date) Series(javafx.scene.chart.XYChart.Series) CategoryAxis(javafx.scene.chart.CategoryAxis) LineChart(javafx.scene.chart.LineChart)

Example 2 with CategoryAxis

use of javafx.scene.chart.CategoryAxis in project Gargoyle by callakrsos.

the class PMDViolationbyBarChartComposite method createNode.

/* (non-Javadoc)
	 * @see com.kyj.fx.voeditor.visual.component.pmd.chart.PMDViolationChartVisualable#createNode()
	 */
@Override
public Node createNode() {
    xAxis = new CategoryAxis();
    xAxis.setAutoRanging(false);
    xAxis.setAnimated(false);
    yAxis = new NumberAxis();
    yAxis.setAnimated(false);
    yAxis.setPrefWidth(60d);
    yAxis.setAutoRanging(true);
    yAxis.setMaxWidth(60d);
    yAxis.setLabel("Violation Count");
    Series<String, Number> dataList = new Series<>(FXCollections.observableArrayList());
    dataList.setName("Priority");
    BarChart<String, Number> c = new BarChart<>(xAxis, yAxis);
    barChart.set(c);
    series = c.getData();
    series.add(0, dataList);
    this.dataList = dataList.getData();
    return c;
}
Also used : Series(javafx.scene.chart.XYChart.Series) NumberAxis(javafx.scene.chart.NumberAxis) CategoryAxis(javafx.scene.chart.CategoryAxis) BarChart(javafx.scene.chart.BarChart)

Example 3 with CategoryAxis

use of javafx.scene.chart.CategoryAxis in project tilesfx by HanSolo.

the class Tile method init.

// ******************** Initialization ************************************
private void init() {
    _minValue = 0;
    _maxValue = 100;
    value = new DoublePropertyBase(_minValue) {

        private void update() {
            final double VALUE = get();
            withinSpeedLimit = !(Instant.now().minusMillis(getAnimationDuration()).isBefore(lastCall));
            lastCall = Instant.now();
            if (isAnimated() && withinSpeedLimit) {
                long animationDuration = isReturnToZero() ? (long) (0.2 * getAnimationDuration()) : getAnimationDuration();
                timeline.stop();
                final KeyValue KEY_VALUE = new KeyValue(currentValue, VALUE, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
                final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(animationDuration), KEY_VALUE);
                timeline.getKeyFrames().setAll(KEY_FRAME);
                timeline.play();
            } else {
                currentValue.set(VALUE);
                fireTileEvent(FINISHED_EVENT);
            }
            if (isAveragingEnabled()) {
                movingAverage.addData(new TimeData(VALUE));
            }
        }

        @Override
        protected void invalidated() {
            update();
        }

        @Override
        public void set(final double VALUE) {
            // only get invalid if the the new value is different from the old value
            if (Helper.equals(VALUE, getFormerValue())) {
                update();
            }
            super.set(VALUE);
            fireTileEvent(VALUE_EVENT);
        }

        @Override
        public Object getBean() {
            return Tile.this;
        }

        @Override
        public String getName() {
            return "value";
        }
    };
    oldValue = new SimpleDoubleProperty(Tile.this, "oldValue", value.get());
    currentValue = new DoublePropertyBase(value.get()) {

        @Override
        protected void invalidated() {
            final double VALUE = get();
            if (isCheckThreshold()) {
                double thrshld = getThreshold();
                if (formerValue.get() < thrshld && VALUE > thrshld) {
                    fireTileEvent(EXCEEDED_EVENT);
                } else if (formerValue.get() > thrshld && VALUE < thrshld) {
                    fireTileEvent(UNDERRUN_EVENT);
                }
            }
            if (VALUE < getMinMeasuredValue()) {
                setMinMeasuredValue(VALUE);
            } else if (VALUE > getMaxMeasuredValue()) {
                setMaxMeasuredValue(VALUE);
            }
            formerValue.set(VALUE);
        }

        @Override
        public void set(final double VALUE) {
            super.set(VALUE);
        }

        @Override
        public Object getBean() {
            return Tile.this;
        }

        @Override
        public String getName() {
            return "currentValue";
        }
    };
    formerValue = new SimpleDoubleProperty(Tile.this, "formerValue", value.get());
    _range = _maxValue - _minValue;
    _threshold = _maxValue;
    _referenceValue = _minValue;
    _autoReferenceValue = true;
    currentTime = new LongPropertyBase(getTime().toEpochSecond()) {

        @Override
        public Object getBean() {
            return Tile.this;
        }

        @Override
        public String getName() {
            return "currentTime";
        }
    };
    _title = "";
    _titleAlignment = TextAlignment.LEFT;
    _description = "";
    _descriptionAlignment = Pos.TOP_RIGHT;
    _unit = "";
    oldFlipText = "";
    _flipText = "";
    _active = false;
    _text = "";
    _textAlignment = TextAlignment.LEFT;
    _averagingEnabled = false;
    _averagingPeriod = 10;
    _duration = LocalTime.of(1, 0);
    _currentLocation = new Location(0, 0);
    _trackColor = TileColor.BLUE;
    _mapProvider = MapProvider.BW;
    flipTimeInMS = 500;
    _textSize = TextSize.NORMAL;
    _roundedCorners = true;
    _startFromZero = false;
    _returnToZero = false;
    _minMeasuredValue = _maxValue;
    _maxMeasuredValue = _minValue;
    _minMeasuredValueVisible = false;
    _maxMeasuredValueVisible = false;
    _oldValueVisible = false;
    _valueVisible = true;
    _foregroundColor = FOREGROUND;
    _backgroundColor = BACKGROUND;
    _borderColor = Color.TRANSPARENT;
    _borderWidth = 1;
    _knobColor = FOREGROUND;
    _activeColor = BLUE;
    _animated = false;
    animationDuration = 800;
    _startAngle = 0;
    _angleRange = 180;
    _angleStep = _angleRange / _range;
    _autoScale = true;
    _shadowsEnabled = false;
    _locale = Locale.US;
    _numberFormat = NumberFormat.getInstance(_locale);
    _decimals = 1;
    _tickLabelDecimals = 1;
    _needleColor = FOREGROUND;
    _hourColor = FOREGROUND;
    _minuteColor = FOREGROUND;
    _secondColor = FOREGROUND;
    _barColor = BLUE;
    _barBackgroundColor = BACKGROUND;
    _titleColor = FOREGROUND;
    _descriptionColor = FOREGROUND;
    _unitColor = FOREGROUND;
    _valueColor = FOREGROUND;
    _textColor = FOREGROUND;
    _dateColor = FOREGROUND;
    _hourTickMarkColor = FOREGROUND;
    _minuteTickMarkColor = FOREGROUND;
    _alarmColor = FOREGROUND;
    _thresholdColor = RED;
    _checkSectionsForValue = false;
    _checkThreshold = false;
    _innerShadowEnabled = false;
    _thresholdVisible = false;
    _averageVisible = false;
    _sectionsVisible = false;
    _sectionsAlwaysVisible = false;
    _sectionTextVisible = false;
    _sectionIconsVisible = false;
    _highlightSections = false;
    _orientation = Orientation.HORIZONTAL;
    _keepAspect = true;
    _customFontEnabled = false;
    _customFont = Fonts.latoRegular(12);
    _alert = false;
    _alertMessage = "";
    _smoothing = false;
    _secondsVisible = false;
    _discreteSeconds = true;
    _discreteMinutes = true;
    _discreteHours = false;
    _textVisible = true;
    _dateVisible = false;
    _running = false;
    _hourTickMarksVisible = true;
    _minuteTickMarksVisible = true;
    _alarmsEnabled = false;
    _alarmsVisible = false;
    _strokeWithGradient = false;
    _fillWithGradient = false;
    tooltip = new Tooltip(null);
    _xAxis = new CategoryAxis();
    _yAxis = new NumberAxis();
    _radarChartMode = Mode.POLYGON;
    _chartGridColor = Tile.GRAY;
    _sortedData = true;
    _dataPointsVisible = false;
    _snapToTicks = false;
    _minorTickCount = 0;
    _majorTickUnit = 1;
    _matrixSize = new int[] { 30, 25 };
    _chartType = ChartType.LINE;
    _tooltipTimeout = 2000;
    _notificationBackgroundColor = Tile.YELLOW;
    _notificationForegroundColor = Tile.BACKGROUND;
    updateInterval = LONG_INTERVAL;
    increment = 1;
    originalMinValue = -Double.MAX_VALUE;
    originalMaxValue = Double.MAX_VALUE;
    originalThreshold = Double.MAX_VALUE;
    lastCall = Instant.now();
    timeline = new Timeline();
    timeline.setOnFinished(e -> {
        if (isReturnToZero() && !Helper.equals(currentValue.get(), 0.0)) {
            final KeyValue KEY_VALUE2 = new KeyValue(value, 0, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
            final KeyFrame KEY_FRAME2 = new KeyFrame(Duration.millis((long) (0.8 * getAnimationDuration())), KEY_VALUE2);
            timeline.getKeyFrames().setAll(KEY_FRAME2);
            timeline.play();
        }
        fireTileEvent(FINISHED_EVENT);
    });
}
Also used : KeyValue(javafx.animation.KeyValue) NumberAxis(javafx.scene.chart.NumberAxis) Tooltip(javafx.scene.control.Tooltip) Timeline(javafx.animation.Timeline) CategoryAxis(javafx.scene.chart.CategoryAxis) TimeData(eu.hansolo.tilesfx.tools.TimeData) KeyFrame(javafx.animation.KeyFrame) Location(eu.hansolo.tilesfx.tools.Location)

Example 4 with CategoryAxis

use of javafx.scene.chart.CategoryAxis in project jvarkit by lindenb.

the class VariantDepthChartFactory method build.

@Override
public Chart build() {
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("DP");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");
    final XYChart.Series<String, Number> serie = new XYChart.Series<String, Number>();
    serie.setName(xAxis.getLabel());
    for (Integer dp : new TreeSet<>(this.afindexcount.keySet())) {
        serie.getData().add(new XYChart.Data<String, Number>(String.valueOf(dp), this.afindexcount.count(dp)));
    }
    final BarChart<String, Number> sbc = new BarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle(this.getName());
    sbc.getData().add(serie);
    sbc.setCategoryGap(0.2);
    sbc.setLegendVisible(false);
    return sbc;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) CategoryAxis(javafx.scene.chart.CategoryAxis) TreeSet(java.util.TreeSet) BarChart(javafx.scene.chart.BarChart) XYChart(javafx.scene.chart.XYChart)

Example 5 with CategoryAxis

use of javafx.scene.chart.CategoryAxis in project jvarkit by lindenb.

the class AFByPopulationChartFactory method build.

@Override
public Chart build() {
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Population");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Mean-MAF");
    final XYChart.Series<String, Number> serie = new XYChart.Series<String, Number>();
    serie.setName("Population");
    for (int i = 0; i < this.popcount.size(); ++i) {
        final PedFile.Status status = PedFile.Status.values()[i];
        double v = 0;
        if (this.popcount.get(i).num_maf > 0) {
            v = this.popcount.get(i).sum / ((double) this.popcount.get(i).num_maf);
        }
        serie.getData().add(new XYChart.Data<String, Number>(status.name(), v));
    }
    final BarChart<String, Number> sbc = new BarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle(this.getName());
    sbc.getData().add(serie);
    sbc.setCategoryGap(0.2);
    sbc.setLegendVisible(false);
    return sbc;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) PedFile(com.github.lindenb.jvarkit.tools.vcfviewgui.PedFile) CategoryAxis(javafx.scene.chart.CategoryAxis) BarChart(javafx.scene.chart.BarChart) XYChart(javafx.scene.chart.XYChart)

Aggregations

CategoryAxis (javafx.scene.chart.CategoryAxis)17 NumberAxis (javafx.scene.chart.NumberAxis)15 XYChart (javafx.scene.chart.XYChart)11 StackedBarChart (javafx.scene.chart.StackedBarChart)7 BarChart (javafx.scene.chart.BarChart)6 ArrayList (java.util.ArrayList)5 TreeSet (java.util.TreeSet)3 PedFile (com.github.lindenb.jvarkit.tools.vcfviewgui.PedFile)2 Series (javafx.scene.chart.XYChart.Series)2 GraphDataBean (com.canoo.dp.impl.platform.projector.graph.GraphDataBean)1 GraphMetadata (com.canoo.dp.impl.platform.projector.graph.GraphMetadata)1 GraphType (com.canoo.dp.impl.platform.projector.graph.GraphType)1 MetadataUtilities (com.canoo.dp.impl.platform.projector.metadata.MetadataUtilities)1 Binding (com.canoo.platform.core.functional.Binding)1 Subscription (com.canoo.platform.core.functional.Subscription)1 FXBinder (com.canoo.platform.remoting.client.javafx.FXBinder)1 BaseGoogleTrendChart (com.kyj.fx.voeditor.visual.component.chart.service.BaseGoogleTrendChart)1 JavaTextArea (com.kyj.fx.voeditor.visual.component.text.JavaTextArea)1 Location (eu.hansolo.tilesfx.tools.Location)1 TimeData (eu.hansolo.tilesfx.tools.TimeData)1