Search in sources :

Example 1 with JsFunction

use of io.jmix.charts.model.JsFunction in project jmix by jmix-framework.

the class StockChartLoader method loadStockGraph.

protected void loadStockGraph(StockGraph stockGraph, Element stockGraphElement) {
    loadGraph(stockGraph, stockGraphElement);
    String comparable = stockGraphElement.attributeValue("comparable");
    if (StringUtils.isNotEmpty(comparable)) {
        stockGraph.setComparable(Boolean.valueOf(comparable));
    }
    String compareField = stockGraphElement.attributeValue("compareField");
    if (StringUtils.isNotEmpty(compareField)) {
        stockGraph.setCompareField(compareField);
    }
    String compareFromStart = stockGraphElement.attributeValue("compareFromStart");
    if (StringUtils.isNotEmpty(compareFromStart)) {
        stockGraph.setCompareFromStart(Boolean.valueOf(compareFromStart));
    }
    Element compareGraphElement = stockGraphElement.element("compareGraph");
    if (compareGraphElement != null) {
        Graph compareGraph = new Graph();
        loadGraph(compareGraph, compareGraphElement);
        stockGraph.setCompareGraph(compareGraph);
    }
    String compareGraphBalloonColor = stockGraphElement.attributeValue("compareGraphBalloonColor");
    if (StringUtils.isNotEmpty(compareGraphBalloonColor)) {
        stockGraph.setCompareGraphBalloonColor(Color.valueOf(compareGraphBalloonColor));
    }
    String compareGraphBalloonFunction = stockGraphElement.elementText("compareGraphBalloonFunction");
    if (StringUtils.isNotBlank(compareGraphBalloonFunction)) {
        stockGraph.setCompareGraphBalloonFunction(new JsFunction(compareGraphBalloonFunction));
    }
    String compareGraphBalloonText = stockGraphElement.attributeValue("compareGraphBalloonText");
    if (StringUtils.isNotEmpty(compareGraphBalloonText)) {
        stockGraph.setCompareGraphBalloonText(compareGraphBalloonText);
    }
    String compareGraphBullet = stockGraphElement.attributeValue("compareGraphBullet");
    if (StringUtils.isNotEmpty(compareGraphBullet)) {
        stockGraph.setCompareGraphBullet(compareGraphBullet);
    }
    String compareGraphBulletBorderAlpha = stockGraphElement.attributeValue("compareGraphBulletBorderAlpha");
    if (StringUtils.isNotEmpty(compareGraphBulletBorderAlpha)) {
        stockGraph.setCompareGraphBulletBorderAlpha(Double.valueOf(compareGraphBulletBorderAlpha));
    }
    String compareGraphBulletBorderColor = stockGraphElement.attributeValue("compareGraphBulletBorderColor");
    if (StringUtils.isNotEmpty(compareGraphBulletBorderColor)) {
        stockGraph.setCompareGraphBulletBorderColor(Color.valueOf(compareGraphBulletBorderColor));
    }
    String compareGraphBulletBorderThickness = stockGraphElement.attributeValue("compareGraphBulletBorderThickness");
    if (StringUtils.isNotEmpty(compareGraphBulletBorderThickness)) {
        stockGraph.setCompareGraphBulletBorderThickness(Integer.valueOf(compareGraphBulletBorderThickness));
    }
    String compareGraphBulletColor = stockGraphElement.attributeValue("compareGraphBulletColor");
    if (StringUtils.isNotEmpty(compareGraphBulletColor)) {
        stockGraph.setCompareGraphBulletColor(Color.valueOf(compareGraphBulletColor));
    }
    String compareGraphBulletSize = stockGraphElement.attributeValue("compareGraphBulletSize");
    if (StringUtils.isNotEmpty(compareGraphBulletSize)) {
        stockGraph.setCompareGraphBulletSize(Integer.valueOf(compareGraphBulletSize));
    }
    String compareGraphCornerRadiusTop = stockGraphElement.attributeValue("compareGraphCornerRadiusTop");
    if (StringUtils.isNotEmpty(compareGraphCornerRadiusTop)) {
        stockGraph.setCompareGraphCornerRadiusTop(Integer.valueOf(compareGraphCornerRadiusTop));
    }
    String compareGraphDashLength = stockGraphElement.attributeValue("compareGraphDashLength");
    if (StringUtils.isNotEmpty(compareGraphDashLength)) {
        stockGraph.setCompareGraphDashLength(Integer.valueOf(compareGraphDashLength));
    }
    String compareGraphFillAlphas = stockGraphElement.attributeValue("compareGraphFillAlphas");
    if (StringUtils.isNotEmpty(compareGraphFillAlphas)) {
        stockGraph.setCompareGraphFillAlphas(Double.valueOf(compareGraphFillAlphas));
    }
    Element compareGraphFillColors = stockGraphElement.element("compareGraphFillColors");
    if (compareGraphFillColors != null) {
        List<Color> colors = loadColors(compareGraphFillColors);
        if (CollectionUtils.isNotEmpty(colors)) {
            stockGraph.setCompareGraphFillColors(colors);
        }
    }
    String compareGraphLineAlpha = stockGraphElement.attributeValue("compareGraphLineAlpha");
    if (StringUtils.isNotEmpty(compareGraphLineAlpha)) {
        stockGraph.setCompareGraphLineAlpha(Double.valueOf(compareGraphLineAlpha));
    }
    String compareGraphLineColor = stockGraphElement.attributeValue("compareGraphLineColor");
    if (StringUtils.isNotEmpty(compareGraphLineColor)) {
        stockGraph.setCompareGraphLineColor(Color.valueOf(compareGraphLineColor));
    }
    String compareGraphLineThickness = stockGraphElement.attributeValue("compareGraphLineThickness");
    if (StringUtils.isNotEmpty(compareGraphLineThickness)) {
        stockGraph.setCompareGraphLineThickness(Integer.valueOf(compareGraphLineThickness));
    }
    String compareGraphType = stockGraphElement.attributeValue("compareGraphType");
    if (StringUtils.isNotEmpty(compareGraphType)) {
        stockGraph.setCompareGraphType(GraphType.valueOf(compareGraphType));
    }
    String compareGraphVisibleInLegend = stockGraphElement.attributeValue("compareGraphVisibleInLegend");
    if (StringUtils.isNotEmpty(compareGraphVisibleInLegend)) {
        stockGraph.setCompareGraphVisibleInLegend(Boolean.valueOf(compareGraphVisibleInLegend));
    }
    String periodValue = stockGraphElement.attributeValue("periodValue");
    if (StringUtils.isNotEmpty(periodValue)) {
        stockGraph.setPeriodValue(StockGraphValue.valueOf(periodValue));
    }
    String recalculateValue = stockGraphElement.attributeValue("recalculateValue");
    if (StringUtils.isNotEmpty(recalculateValue)) {
        stockGraph.setRecalculateValue(StockGraphValue.valueOf(recalculateValue));
    }
    String showEventsOnComparedGraphs = stockGraphElement.attributeValue("showEventsOnComparedGraphs");
    if (StringUtils.isNotEmpty(showEventsOnComparedGraphs)) {
        stockGraph.setShowEventsOnComparedGraphs(Boolean.valueOf(showEventsOnComparedGraphs));
    }
    String useDataSetColors = stockGraphElement.attributeValue("useDataSetColors");
    if (StringUtils.isNotEmpty(useDataSetColors)) {
        stockGraph.setUseDataSetColors(Boolean.valueOf(useDataSetColors));
    }
}
Also used : Graph(io.jmix.charts.model.graph.Graph) JsFunction(io.jmix.charts.model.JsFunction) Element(org.dom4j.Element)

Example 2 with JsFunction

use of io.jmix.charts.model.JsFunction in project jmix by jmix-framework.

the class ChartModelLoader method loadCategoryAxis.

protected void loadCategoryAxis(SeriesBasedChartModel chart, Element element) {
    Element axisElement = element.element("categoryAxis");
    if (axisElement != null) {
        CategoryAxis axis = new CategoryAxis();
        loadAbstractAxis(axis, axisElement);
        String autoWrap = axisElement.attributeValue("autoWrap");
        if (StringUtils.isNotEmpty(autoWrap)) {
            axis.setAutoWrap(Boolean.valueOf(autoWrap));
        }
        String categoryFunction = axisElement.elementText("categoryFunction");
        if (StringUtils.isNotEmpty(categoryFunction)) {
            axis.setCategoryFunction(new JsFunction(categoryFunction));
        }
        String classNameField = axisElement.attributeValue("classNameField");
        if (StringUtils.isNotEmpty(classNameField)) {
            axis.setClassNameField(classNameField);
        }
        String centerLabelOnFullPeriod = axisElement.attributeValue("centerLabelOnFullPeriod");
        if (StringUtils.isNotEmpty(centerLabelOnFullPeriod)) {
            axis.setCenterLabelOnFullPeriod(Boolean.valueOf(centerLabelOnFullPeriod));
        }
        String equalSpacing = axisElement.attributeValue("equalSpacing");
        if (StringUtils.isNotEmpty(equalSpacing)) {
            axis.setEqualSpacing(Boolean.valueOf(equalSpacing));
        }
        String forceShowField = axisElement.attributeValue("forceShowField");
        if (StringUtils.isNotEmpty(forceShowField)) {
            axis.setForceShowField(forceShowField);
        }
        String gridPosition = axisElement.attributeValue("gridPosition");
        if (StringUtils.isNotEmpty(gridPosition)) {
            axis.setGridPosition(GridPosition.valueOf(gridPosition));
        }
        String labelFunction = axisElement.elementText("labelFunction");
        if (StringUtils.isNotBlank(labelFunction)) {
            axis.setLabelFunction(new JsFunction(labelFunction));
        }
        String labelColorField = axisElement.attributeValue("labelColorField");
        if (StringUtils.isNotEmpty(labelColorField)) {
            axis.setLabelColorField(labelColorField);
        }
        String minPeriod = axisElement.attributeValue("minPeriod");
        if (StringUtils.isNotEmpty(minPeriod)) {
            DatePeriod dp = DatePeriod.fromId(minPeriod);
            if (dp == null) {
                dp = DatePeriod.valueOf(minPeriod);
            }
            axis.setMinPeriod(dp);
        }
        String parseDates = axisElement.attributeValue("parseDates");
        if (StringUtils.isNotEmpty(parseDates)) {
            axis.setParseDates(Boolean.valueOf(parseDates));
        }
        String startOnAxis = axisElement.attributeValue("startOnAxis");
        if (StringUtils.isNotEmpty(startOnAxis)) {
            axis.setStartOnAxis(Boolean.valueOf(startOnAxis));
        }
        String tickPosition = axisElement.attributeValue("tickPosition");
        if (StringUtils.isNotEmpty(tickPosition)) {
            axis.setTickPosition(tickPosition);
        }
        String twoLineMode = axisElement.attributeValue("twoLineMode");
        if (StringUtils.isNotEmpty(twoLineMode)) {
            axis.setTwoLineMode(Boolean.valueOf(twoLineMode));
        }
        String widthField = axisElement.attributeValue("widthField");
        if (StringUtils.isNotEmpty(widthField)) {
            axis.setWidthField(widthField);
        }
        chart.setCategoryAxis(axis);
    }
}
Also used : JsFunction(io.jmix.charts.model.JsFunction) Element(org.dom4j.Element) DatePeriod(io.jmix.charts.model.date.DatePeriod)

Example 3 with JsFunction

use of io.jmix.charts.model.JsFunction in project jmix by jmix-framework.

the class ChartModelLoader method loadGraph.

protected void loadGraph(AbstractGraph graph, Element graphElement) {
    String accessibleLabel = graphElement.attributeValue("accessibleLabel");
    if (StringUtils.isNotEmpty(accessibleLabel)) {
        graph.setAccessibleLabel(loadResourceString(accessibleLabel));
    }
    String alphaField = graphElement.attributeValue("alphaField");
    if (StringUtils.isNotEmpty(alphaField)) {
        graph.setAlphaField(alphaField);
    }
    String animationPlayed = graphElement.attributeValue("animationPlayed");
    if (StringUtils.isNotEmpty(animationPlayed)) {
        graph.setAnimationPlayed(Boolean.valueOf(animationPlayed));
    }
    Element balloonElement = graphElement.element("balloon");
    if (balloonElement != null) {
        graph.setBalloon(loadBalloon(balloonElement));
    }
    String balloonColor = graphElement.attributeValue("balloonColor");
    if (StringUtils.isNotEmpty(balloonColor)) {
        graph.setBalloonColor(Color.valueOf(balloonColor));
    }
    String balloonFunction = graphElement.elementText("balloonFunction");
    if (StringUtils.isNotEmpty(balloonFunction)) {
        graph.setBalloonFunction(new JsFunction(balloonFunction));
    }
    String balloonText = graphElement.attributeValue("balloonText");
    if (StringUtils.isNotEmpty(balloonText)) {
        graph.setBalloonText(loadResourceString(balloonText));
    }
    String behindColumns = graphElement.attributeValue("behindColumns");
    if (StringUtils.isNotEmpty(behindColumns)) {
        graph.setBehindColumns(Boolean.valueOf(behindColumns));
    }
    String bullet = graphElement.attributeValue("bullet");
    if (StringUtils.isNotEmpty(bullet)) {
        graph.setBullet(BulletType.valueOf(bullet));
    }
    String bulletAlpha = graphElement.attributeValue("bulletAlpha");
    if (StringUtils.isNotEmpty(bulletAlpha)) {
        graph.setBulletAlpha(Double.valueOf(bulletAlpha));
    }
    String bulletAxis = graphElement.attributeValue("bulletAxis");
    if (StringUtils.isNotEmpty(bulletAxis)) {
        graph.setBulletAxis(bulletAxis);
    }
    String bulletBorderAlpha = graphElement.attributeValue("bulletBorderAlpha");
    if (StringUtils.isNotEmpty(bulletBorderAlpha)) {
        graph.setBulletBorderAlpha(Double.valueOf(bulletBorderAlpha));
    }
    String bulletBorderColor = graphElement.attributeValue("bulletBorderColor");
    if (StringUtils.isNotEmpty(bulletBorderColor)) {
        graph.setBulletBorderColor(Color.valueOf(bulletBorderColor));
    }
    String bulletBorderThickness = graphElement.attributeValue("bulletBorderThickness");
    if (StringUtils.isNotEmpty(bulletBorderThickness)) {
        graph.setBulletBorderThickness(Integer.valueOf(bulletBorderThickness));
    }
    String bulletColor = graphElement.attributeValue("bulletColor");
    if (StringUtils.isNotEmpty(bulletColor)) {
        graph.setBulletColor(Color.valueOf(bulletColor));
    }
    String bulletField = graphElement.attributeValue("bulletField");
    if (StringUtils.isNotEmpty(bulletField)) {
        graph.setBulletField(bulletField);
    }
    String bulletHitAreaSize = graphElement.attributeValue("bulletHitAreaSize");
    if (StringUtils.isNotEmpty(bulletHitAreaSize)) {
        graph.setBulletHitAreaSize(Integer.valueOf(bulletHitAreaSize));
    }
    String bulletOffset = graphElement.attributeValue("bulletOffset");
    if (StringUtils.isNotEmpty(bulletOffset)) {
        graph.setBulletOffset(Integer.valueOf(bulletOffset));
    }
    String bulletSize = graphElement.attributeValue("bulletSize");
    if (StringUtils.isNotEmpty(bulletSize)) {
        graph.setBulletSize(Integer.valueOf(bulletSize));
    }
    String classNameField = graphElement.attributeValue("classNameField");
    if (StringUtils.isNotEmpty(classNameField)) {
        graph.setClassNameField(classNameField);
    }
    String bulletSizeField = graphElement.attributeValue("bulletSizeField");
    if (StringUtils.isNotEmpty(bulletSizeField)) {
        graph.setBulletSizeField(bulletSizeField);
    }
    String closeField = graphElement.attributeValue("closeField");
    if (StringUtils.isNotEmpty(closeField)) {
        graph.setCloseField(closeField);
    }
    String clustered = graphElement.attributeValue("clustered");
    if (StringUtils.isNotEmpty(clustered)) {
        graph.setClustered(Boolean.valueOf(clustered));
    }
    String color = graphElement.attributeValue("color");
    if (StringUtils.isNotEmpty(color)) {
        graph.setColor(Color.valueOf(color));
    }
    String colorField = graphElement.attributeValue("colorField");
    if (StringUtils.isNotEmpty(colorField)) {
        graph.setColorField(colorField);
    }
    String columnIndexField = graphElement.attributeValue("columnIndexField");
    if (StringUtils.isNotEmpty(columnIndexField)) {
        graph.setColumnIndexField(columnIndexField);
    }
    String columnWidth = graphElement.attributeValue("columnWidth");
    if (StringUtils.isNotEmpty(columnWidth)) {
        graph.setColumnWidth(Double.valueOf(columnWidth));
    }
    String connect = graphElement.attributeValue("connect");
    if (StringUtils.isNotEmpty(connect)) {
        graph.setConnect(Boolean.valueOf(connect));
    }
    String cornerRadiusTop = graphElement.attributeValue("cornerRadiusTop");
    if (StringUtils.isNotEmpty(cornerRadiusTop)) {
        graph.setCornerRadiusTop(Integer.valueOf(cornerRadiusTop));
    }
    String cursorBulletAlpha = graphElement.attributeValue("cursorBulletAlpha");
    if (StringUtils.isNotEmpty(cursorBulletAlpha)) {
        graph.setCursorBulletAlpha(Double.valueOf(cursorBulletAlpha));
    }
    String customBullet = graphElement.attributeValue("customBullet");
    if (StringUtils.isNotEmpty(customBullet)) {
        graph.setCustomBullet(customBullet);
    }
    String customBulletField = graphElement.attributeValue("customBulletField");
    if (StringUtils.isNotEmpty(customBulletField)) {
        graph.setCustomBulletField(customBulletField);
    }
    String customMarker = graphElement.attributeValue("customMarker");
    if (StringUtils.isNotEmpty(customMarker)) {
        graph.setCustomMarker(customMarker);
    }
    String dashLength = graphElement.attributeValue("dashLength");
    if (StringUtils.isNotEmpty(dashLength)) {
        graph.setDashLength(Integer.valueOf(dashLength));
    }
    String dashLengthField = graphElement.attributeValue("dashLengthField");
    if (StringUtils.isNotEmpty(dashLengthField)) {
        graph.setDashLengthField(dashLengthField);
    }
    Element dateFormatElement = graphElement.element("dateFormat");
    if (dateFormatElement != null) {
        DateFormat dateFormat = new DateFormat();
        loadDateFormat(dateFormat, dateFormatElement);
        graph.setDateFormat(dateFormat);
    }
    String descriptionField = graphElement.attributeValue("descriptionField");
    if (StringUtils.isNotEmpty(descriptionField)) {
        graph.setDescriptionField(descriptionField);
    }
    String errorField = graphElement.attributeValue("errorField");
    if (StringUtils.isNotEmpty(errorField)) {
        graph.setErrorField(errorField);
    }
    String fillAlphas = graphElement.attributeValue("fillAlphas");
    if (StringUtils.isNotEmpty(fillAlphas)) {
        graph.setFillAlphas(Double.valueOf(fillAlphas));
    }
    Element fillColorsElement = graphElement.element("fillColors");
    if (fillColorsElement != null) {
        List<Color> colors = loadColors(fillColorsElement);
        if (CollectionUtils.isNotEmpty(colors)) {
            graph.setFillColors(colors);
        }
    }
    String fillColorsField = graphElement.attributeValue("fillColorsField");
    if (StringUtils.isNotEmpty(fillColorsField)) {
        graph.setFillColorsField(fillColorsField);
    }
    String fillToAxis = graphElement.attributeValue("fillToAxis");
    if (StringUtils.isNotEmpty(fillToAxis)) {
        graph.setFillToAxis(fillToAxis);
    }
    String fillToGraph = graphElement.attributeValue("fillToGraph");
    if (StringUtils.isNotEmpty(fillToGraph)) {
        graph.setFillToGraph(fillToGraph);
    }
    String fixedColumnWidth = graphElement.attributeValue("fixedColumnWidth");
    if (StringUtils.isNotEmpty(fixedColumnWidth)) {
        graph.setFixedColumnWidth(Integer.valueOf(fixedColumnWidth));
    }
    String fontSize = graphElement.attributeValue("fontSize");
    if (StringUtils.isNotEmpty(fontSize)) {
        graph.setFontSize(Integer.valueOf(fontSize));
    }
    String forceGap = graphElement.attributeValue("forceGap");
    if (StringUtils.isNotEmpty(forceGap)) {
        graph.setForceGap(Boolean.valueOf(forceGap));
    }
    String gapField = graphElement.attributeValue("gapField");
    if (StringUtils.isNotEmpty(gapField)) {
        graph.setGapField(gapField);
    }
    String gapPeriod = graphElement.attributeValue("gapPeriod");
    if (StringUtils.isNotEmpty(gapPeriod)) {
        graph.setGapPeriod(Double.valueOf(gapPeriod));
    }
    String gradientOrientation = graphElement.attributeValue("gradientOrientation");
    if (StringUtils.isNotEmpty(gradientOrientation)) {
        graph.setGradientOrientation(GradientOrientation.valueOf(gradientOrientation));
    }
    String hidden = graphElement.attributeValue("hidden");
    if (StringUtils.isNotEmpty(hidden)) {
        graph.setHidden(Boolean.valueOf(hidden));
    }
    String hideBulletsCount = graphElement.attributeValue("hideBulletsCount");
    if (StringUtils.isNotEmpty(hideBulletsCount)) {
        graph.setHideBulletsCount(Integer.valueOf(hideBulletsCount));
    }
    String highField = graphElement.attributeValue("highField");
    if (StringUtils.isNotEmpty(highField)) {
        graph.setHighField(highField);
    }
    String id = graphElement.attributeValue("id");
    if (StringUtils.isNotEmpty(id)) {
        graph.setId(id);
    }
    String includeInMinMax = graphElement.attributeValue("includeInMinMax");
    if (StringUtils.isNotEmpty(includeInMinMax)) {
        graph.setIncludeInMinMax(Boolean.valueOf(includeInMinMax));
    }
    String labelAnchor = graphElement.attributeValue("labelAnchor");
    if (StringUtils.isNotEmpty(labelAnchor)) {
        graph.setLabelAnchor(labelAnchor);
    }
    String labelColorField = graphElement.attributeValue("labelColorField");
    if (StringUtils.isNotEmpty(labelColorField)) {
        graph.setLabelColorField(labelColorField);
    }
    String labelFunction = graphElement.elementText("labelFunction");
    if (StringUtils.isNotBlank(labelFunction)) {
        graph.setLabelFunction(new JsFunction(labelFunction));
    }
    String labelOffset = graphElement.attributeValue("labelOffset");
    if (StringUtils.isNotEmpty(labelOffset)) {
        graph.setLabelOffset(Integer.valueOf(labelOffset));
    }
    String labelPosition = graphElement.attributeValue("labelPosition");
    if (StringUtils.isNotEmpty(labelPosition)) {
        graph.setLabelPosition(ValueLabelPosition.valueOf(labelPosition));
    }
    String labelRotation = graphElement.attributeValue("labelRotation");
    if (StringUtils.isNotEmpty(labelRotation)) {
        graph.setLabelRotation(Integer.valueOf(labelRotation));
    }
    String labelText = graphElement.attributeValue("labelText");
    if (StringUtils.isNotEmpty(labelText)) {
        graph.setLabelText(loadResourceString(labelText));
    }
    String legendAlpha = graphElement.attributeValue("legendAlpha");
    if (StringUtils.isNotEmpty(legendAlpha)) {
        graph.setLegendAlpha(Double.valueOf(legendAlpha));
    }
    String legendColor = graphElement.attributeValue("legendColor");
    if (StringUtils.isNotEmpty(legendColor)) {
        graph.setLegendColor(Color.valueOf(legendColor));
    }
    String legendColorFunction = graphElement.elementText("legendColorFunction");
    if (StringUtils.isNotBlank(legendColorFunction)) {
        graph.setLegendColorFunction(new JsFunction(legendColorFunction));
    }
    String legendPeriodValueText = graphElement.attributeValue("legendPeriodValueText");
    if (StringUtils.isNotEmpty(legendPeriodValueText)) {
        graph.setLegendPeriodValueText(loadResourceString(legendPeriodValueText));
    }
    String legendValueText = graphElement.attributeValue("legendValueText");
    if (StringUtils.isNotEmpty(legendValueText)) {
        graph.setLegendValueText(loadResourceString(legendValueText));
    }
    String lineAlpha = graphElement.attributeValue("lineAlpha");
    if (StringUtils.isNotEmpty(lineAlpha)) {
        graph.setLineAlpha(Double.valueOf(lineAlpha));
    }
    String lineColor = graphElement.attributeValue("lineColor");
    if (StringUtils.isNotEmpty(lineColor)) {
        graph.setLineColor(Color.valueOf(lineColor));
    }
    String lineColorField = graphElement.attributeValue("lineColorField");
    if (StringUtils.isNotEmpty("lineColorField")) {
        graph.setLineColorField(lineColorField);
    }
    String lineThickness = graphElement.attributeValue("lineThickness");
    if (StringUtils.isNotEmpty(lineThickness)) {
        graph.setLineThickness(Integer.valueOf(lineThickness));
    }
    String lowField = graphElement.attributeValue("lowField");
    if (StringUtils.isNotEmpty(lowField)) {
        graph.setLowField(lowField);
    }
    String markerType = graphElement.attributeValue("markerType");
    if (StringUtils.isNotEmpty(markerType)) {
        graph.setMarkerType(MarkerType.valueOf(markerType));
    }
    String maxBulletSize = graphElement.attributeValue("maxBulletSize");
    if (StringUtils.isNotEmpty(maxBulletSize)) {
        graph.setMaxBulletSize(Integer.valueOf(maxBulletSize));
    }
    String minBulletSize = graphElement.attributeValue("minBulletSize");
    if (StringUtils.isNotEmpty(minBulletSize)) {
        graph.setMinBulletSize(Integer.valueOf(minBulletSize));
    }
    String minDistance = graphElement.attributeValue("minDistance");
    if (StringUtils.isNotEmpty(minDistance)) {
        graph.setMinDistance(Integer.valueOf(minDistance));
    }
    String negativeBase = graphElement.attributeValue("negativeBase");
    if (StringUtils.isNotEmpty(negativeBase)) {
        graph.setNegativeBase(Double.valueOf(negativeBase));
    }
    String negativeFillAlphas = graphElement.attributeValue("negativeFillAlphas");
    if (StringUtils.isNotEmpty(negativeFillAlphas)) {
        graph.setNegativeFillAlphas(Double.valueOf(negativeFillAlphas));
    }
    Element negativeFillColors = graphElement.element("negativeFillColors");
    if (negativeFillColors != null) {
        List<Color> colors = loadColors(negativeFillColors);
        if (CollectionUtils.isNotEmpty(colors)) {
            graph.setNegativeFillColors(colors);
        }
    }
    String negativeLineAlpha = graphElement.attributeValue("negativeLineAlpha");
    if (StringUtils.isNotEmpty(negativeLineAlpha)) {
        graph.setNegativeLineAlpha(Double.valueOf(negativeLineAlpha));
    }
    String negativeLineColor = graphElement.attributeValue("negativeLineColor");
    if (StringUtils.isNotEmpty(negativeLineColor)) {
        graph.setNegativeLineColor(Color.valueOf(negativeLineColor));
    }
    String newStack = graphElement.attributeValue("newStack");
    if (StringUtils.isNotEmpty(newStack)) {
        graph.setNewStack(Boolean.valueOf(newStack));
    }
    String noStepRisers = graphElement.attributeValue("noStepRisers");
    if (StringUtils.isNotEmpty(noStepRisers)) {
        graph.setNoStepRisers(Boolean.valueOf(noStepRisers));
    }
    String openField = graphElement.attributeValue("openField");
    if (StringUtils.isNotEmpty(openField)) {
        graph.setOpenField(openField);
    }
    Element patternElement = graphElement.element("pattern");
    if (patternElement != null) {
        graph.setPattern(loadPattern(patternElement));
    }
    String patternField = graphElement.attributeValue("patternField");
    if (StringUtils.isNotEmpty(patternField)) {
        graph.setPatternField(patternField);
    }
    String periodSpan = graphElement.attributeValue("periodSpan");
    if (StringUtils.isNotEmpty(periodSpan)) {
        graph.setPeriodSpan(Integer.valueOf(periodSpan));
    }
    String pointPosition = graphElement.attributeValue("pointPosition");
    if (StringUtils.isNotEmpty(pointPosition)) {
        graph.setPointPosition(PointPosition.valueOf(pointPosition));
    }
    String precision = graphElement.attributeValue("precision");
    if (StringUtils.isNotEmpty(precision)) {
        graph.setPrecision(Integer.valueOf(precision));
    }
    String proCandlesticks = graphElement.attributeValue("proCandlesticks");
    if (StringUtils.isNotEmpty(proCandlesticks)) {
        graph.setProCandlesticks(Boolean.valueOf(proCandlesticks));
    }
    String showAllValueLabels = graphElement.attributeValue("showAllValueLabels");
    if (StringUtils.isNotEmpty(showAllValueLabels)) {
        graph.setShowAllValueLabels(Boolean.valueOf(showAllValueLabels));
    }
    String showBalloon = graphElement.attributeValue("showBalloon");
    if (StringUtils.isNotEmpty(showBalloon)) {
        graph.setShowBalloon(Boolean.valueOf(showBalloon));
    }
    String showBalloonAt = graphElement.attributeValue("showBalloonAt");
    if (StringUtils.isNotEmpty(showBalloonAt)) {
        graph.setShowBalloonAt(ShowPositionOnCandle.valueOf(showBalloonAt));
    }
    String showBulletsAt = graphElement.attributeValue("showBulletsAt");
    if (StringUtils.isNotEmpty(showBulletsAt)) {
        graph.setShowBulletsAt(ShowPositionOnCandle.valueOf(showBulletsAt));
    }
    String showHandOnHover = graphElement.attributeValue("showHandOnHover");
    if (StringUtils.isNotEmpty(showHandOnHover)) {
        graph.setShowHandOnHover(Boolean.valueOf(showHandOnHover));
    }
    String showOnAxis = graphElement.attributeValue("showOnAxis");
    if (StringUtils.isNotEmpty(showOnAxis)) {
        graph.setShowOnAxis(Boolean.valueOf(showOnAxis));
    }
    String stackable = graphElement.attributeValue("stackable");
    if (StringUtils.isNotEmpty(stackable)) {
        graph.setStackable(Boolean.valueOf(stackable));
    }
    String stepDirection = graphElement.attributeValue("stepDirection");
    if (StringUtils.isNotEmpty(stepDirection)) {
        graph.setStepDirection(StepDirection.valueOf(stepDirection));
    }
    String switchable = graphElement.attributeValue("switchable");
    if (StringUtils.isNotEmpty(switchable)) {
        graph.setSwitchable(Boolean.valueOf(switchable));
    }
    String tabIndex = graphElement.attributeValue("tabIndex");
    if (StringUtils.isNotEmpty(tabIndex)) {
        graph.setTabIndex(Integer.valueOf(tabIndex));
    }
    String title = graphElement.attributeValue("title");
    if (StringUtils.isNotEmpty(title)) {
        graph.setTitle(loadResourceString(title));
    }
    String topRadius = graphElement.attributeValue("topRadius");
    if (StringUtils.isNotEmpty(topRadius)) {
        graph.setTopRadius(Integer.valueOf(topRadius));
    }
    String type = graphElement.attributeValue("type");
    if (StringUtils.isNotEmpty(type)) {
        graph.setType(GraphType.valueOf(type));
    }
    String urlField = graphElement.attributeValue("urlField");
    if (StringUtils.isNotEmpty(urlField)) {
        graph.setUrlField(urlField);
    }
    String urlTarget = graphElement.attributeValue("urlTarget");
    if (StringUtils.isNotEmpty(urlTarget)) {
        graph.setUrlTarget(urlTarget);
    }
    String useLineColorForBulletBorder = graphElement.attributeValue("useLineColorForBulletBorder");
    if (StringUtils.isNotEmpty(useLineColorForBulletBorder)) {
        graph.setUseLineColorForBulletBorder(Boolean.valueOf(useLineColorForBulletBorder));
    }
    String useNegativeColorIfDown = graphElement.attributeValue("useNegativeColorIfDown");
    if (StringUtils.isNotEmpty(useNegativeColorIfDown)) {
        graph.setUseNegativeColorIfDown(Boolean.valueOf(useNegativeColorIfDown));
    }
    String valueAxis = graphElement.attributeValue("valueAxis");
    if (StringUtils.isNotEmpty(valueAxis)) {
        graph.setValueAxis(valueAxis);
    }
    String valueField = graphElement.attributeValue("valueField");
    if (StringUtils.isNotEmpty(valueField)) {
        graph.setValueField(valueField);
    }
    String visibleInLegend = graphElement.attributeValue("visibleInLegend");
    if (StringUtils.isNotEmpty(visibleInLegend)) {
        graph.setVisibleInLegend(Boolean.valueOf(visibleInLegend));
    }
    String xAxis = graphElement.attributeValue("xAxis");
    if (StringUtils.isNotEmpty(xAxis)) {
        graph.setXAxis(xAxis);
    }
    String xField = graphElement.attributeValue("xField");
    if (StringUtils.isNotEmpty(xField)) {
        graph.setXField(xField);
    }
    String yAxis = graphElement.attributeValue("yAxis");
    if (StringUtils.isNotEmpty(yAxis)) {
        graph.setYAxis(yAxis);
    }
    String yField = graphElement.attributeValue("yField");
    if (StringUtils.isNotEmpty(yField)) {
        graph.setYField(yField);
    }
}
Also used : JsFunction(io.jmix.charts.model.JsFunction) Element(org.dom4j.Element) FastDateFormat(org.apache.commons.lang3.time.FastDateFormat) DateFormat(io.jmix.charts.model.date.DateFormat)

Example 4 with JsFunction

use of io.jmix.charts.model.JsFunction in project jmix by jmix-framework.

the class PieChartLoader method loadConfiguration.

@Override
protected void loadConfiguration(PieChart chart, Element element) {
    super.loadConfiguration(chart, element);
    String adjustPrecision = element.attributeValue("adjustPrecision");
    if (StringUtils.isNotEmpty(adjustPrecision)) {
        chart.setAdjustPrecision(Boolean.valueOf(adjustPrecision));
    }
    String angle = element.attributeValue("angle");
    if (StringUtils.isNotEmpty(angle)) {
        chart.setAngle(Integer.valueOf(angle));
    }
    String balloonFunction = element.elementText("balloonFunction");
    if (StringUtils.isNotEmpty(balloonFunction)) {
        chart.setBalloonFunction(new JsFunction(balloonFunction));
    }
    String balloonText = element.attributeValue("balloonText");
    if (StringUtils.isNotEmpty(balloonText)) {
        chart.setBalloonText(loadResourceString(balloonText));
    }
    String depth3D = element.attributeValue("depth3D");
    if (StringUtils.isNotEmpty(depth3D)) {
        chart.setDepth3D(Integer.valueOf(depth3D));
    }
    String gradientType = element.attributeValue("gradientType");
    if (StringUtils.isNotEmpty(gradientType)) {
        chart.setGradientType(GradientType.valueOf("gradientType"));
    }
    String innerRadius = element.attributeValue("innerRadius");
    if (StringUtils.isNotEmpty(innerRadius)) {
        chart.setInnerRadius(innerRadius);
    }
    String labelRadius = element.attributeValue("labelRadius");
    if (StringUtils.isNotEmpty(labelRadius)) {
        chart.setLabelRadius(Integer.valueOf(labelRadius));
    }
    String labelRadiusField = element.attributeValue("labelRadiusField");
    if (StringUtils.isNotEmpty(labelRadiusField)) {
        chart.setLabelRadiusField(labelRadiusField);
    }
    String labelText = element.attributeValue("labelText");
    if (StringUtils.isNotEmpty(labelText)) {
        chart.setLabelText(loadResourceString(labelText));
    }
    String minRadius = element.attributeValue("minRadius");
    if (StringUtils.isNotEmpty(minRadius)) {
        chart.setMinRadius(Integer.valueOf(minRadius));
    }
    String pieAlpha = element.attributeValue("pieAlpha");
    if (StringUtils.isNotEmpty(pieAlpha)) {
        chart.setPieAlpha(Double.valueOf(pieAlpha));
    }
    String pieX = element.attributeValue("pieX");
    if (StringUtils.isNotEmpty(pieX)) {
        chart.setPieX(pieX);
    }
    String pieY = element.attributeValue("pieY");
    if (StringUtils.isNotEmpty(pieY)) {
        chart.setPieY(pieY);
    }
    String pullOutRadius = element.attributeValue("pullOutRadius");
    if (StringUtils.isNotEmpty(pullOutRadius)) {
        chart.setPullOutRadius(pullOutRadius);
    }
    String radius = element.attributeValue("radius");
    if (StringUtils.isNotEmpty(radius)) {
        chart.setRadius(radius);
    }
    String startAngle = element.attributeValue("startAngle");
    if (StringUtils.isNotEmpty(startAngle)) {
        chart.setStartAngle(Integer.valueOf(startAngle));
    }
    String startRadius = element.attributeValue("startRadius");
    if (StringUtils.isNotEmpty(startRadius)) {
        chart.setStartRadius(startRadius);
    }
}
Also used : JsFunction(io.jmix.charts.model.JsFunction)

Example 5 with JsFunction

use of io.jmix.charts.model.JsFunction in project jmix by jmix-framework.

the class AngularGaugeChartLoader method loadAxes.

protected void loadAxes(AngularGaugeChart chart, Element element) {
    Element axesListElement = element.element("axes");
    if (axesListElement != null) {
        for (Object axisItem : axesListElement.elements("axis")) {
            Element axisElement = (Element) axisItem;
            GaugeAxis axis = new GaugeAxis();
            loadGaugeBands(axis, axisElement);
            String labelFunction = axesListElement.elementText("labelFunction");
            if (StringUtils.isNotBlank(labelFunction)) {
                axis.setLabelFunction(new JsFunction(labelFunction));
            }
            String axisAlpha = axisElement.attributeValue("axisAlpha");
            if (StringUtils.isNotEmpty(axisAlpha)) {
                axis.setAxisAlpha(Double.valueOf(axisAlpha));
            }
            String axisColor = axisElement.attributeValue("axisColor");
            if (StringUtils.isNotEmpty(axisColor)) {
                axis.setAxisColor(Color.valueOf(axisColor));
            }
            String axisThickness = axisElement.attributeValue("axisThickness");
            if (StringUtils.isNotEmpty(axisThickness)) {
                axis.setAxisThickness(Integer.valueOf(axisThickness));
            }
            String bandAlpha = axisElement.attributeValue("bandAlpha");
            if (StringUtils.isNotEmpty(bandAlpha)) {
                axis.setBandAlpha(Double.valueOf(bandAlpha));
            }
            String bandGradientRatio = axisElement.attributeValue("bandGradientRatio");
            if (StringUtils.isNotEmpty(bandGradientRatio)) {
                List<Float> bandGradientRatioList = new ArrayList<>();
                for (String s : GRADIENT_RATIO_PATTERN.split(bandGradientRatio)) bandGradientRatioList.add(Float.valueOf(s));
                axis.setBandGradientRatio(bandGradientRatioList);
            }
            String bandOutlineAlpha = axisElement.attributeValue("bandOutlineAlpha");
            if (StringUtils.isNotEmpty(bandOutlineAlpha)) {
                axis.setBandOutlineAlpha(Double.valueOf(bandOutlineAlpha));
            }
            String bandOutlineColor = axisElement.attributeValue("bandOutlineColor");
            if (StringUtils.isNotEmpty(bandOutlineColor)) {
                axis.setBandOutlineColor(Color.valueOf(bandOutlineColor));
            }
            String bandOutlineThickness = axisElement.attributeValue("bandOutlineThickness");
            if (StringUtils.isNotEmpty(bandOutlineThickness)) {
                axis.setBandOutlineThickness(Integer.valueOf(bandOutlineThickness));
            }
            String bottomText = axisElement.attributeValue("bottomText");
            if (StringUtils.isNotEmpty(bottomText)) {
                axis.setBottomText(loadResourceString(bottomText));
            }
            String bottomTextBold = axisElement.attributeValue("bottomTextBold");
            if (StringUtils.isNotEmpty(bottomTextBold)) {
                axis.setBottomTextBold(Boolean.valueOf(bottomTextBold));
            }
            String bottomTextColor = axisElement.attributeValue("bottomTextColor");
            if (StringUtils.isNotEmpty(bottomTextColor)) {
                axis.setBottomTextColor(Color.valueOf(bottomTextColor));
            }
            String bottomTextFontSize = axisElement.attributeValue("bottomTextFontSize");
            if (StringUtils.isNotEmpty(bottomTextFontSize)) {
                axis.setBottomTextFontSize(Integer.valueOf(bottomTextFontSize));
            }
            String bottomTextYOffset = axisElement.attributeValue("bottomTextYOffset");
            if (StringUtils.isNotEmpty(bottomTextYOffset)) {
                axis.setBottomTextYOffset(Integer.valueOf(bottomTextYOffset));
            }
            String centerX = axisElement.attributeValue("centerX");
            if (StringUtils.isNotEmpty(centerX)) {
                axis.setCenterX(centerX);
            }
            String centerY = axisElement.attributeValue("centerY");
            if (StringUtils.isNotEmpty(centerY)) {
                axis.setCenterY(centerY);
            }
            String color = axisElement.attributeValue("color");
            if (StringUtils.isNotEmpty(color)) {
                axis.setColor(Color.valueOf(color));
            }
            String endAngle = axisElement.attributeValue("endAngle");
            if (StringUtils.isNotEmpty(endAngle)) {
                axis.setEndAngle(Integer.valueOf(endAngle));
            }
            String endValue = axisElement.attributeValue("endValue");
            if (StringUtils.isNotEmpty(endValue)) {
                axis.setEndValue(Double.valueOf(endValue));
            }
            String fontSize = axisElement.attributeValue("fontSize");
            if (StringUtils.isNotEmpty(fontSize)) {
                axis.setFontSize(Integer.valueOf(fontSize));
            }
            String gridCount = axisElement.attributeValue("gridCount");
            if (StringUtils.isNotEmpty(gridCount)) {
                axis.setGridCount(Integer.valueOf(gridCount));
            }
            String gridInside = axisElement.attributeValue("gridInside");
            if (StringUtils.isNotEmpty(gridInside)) {
                axis.setGridInside(Boolean.valueOf(gridInside));
            }
            String id = axisElement.attributeValue("id");
            if (StringUtils.isNotEmpty(id)) {
                axis.setId(id);
            }
            String inside = axisElement.attributeValue("inside");
            if (StringUtils.isNotEmpty(inside)) {
                axis.setInside(Boolean.valueOf(inside));
            }
            String labelFrequency = axisElement.attributeValue("labelFrequency");
            if (StringUtils.isNotEmpty(labelFrequency)) {
                axis.setLabelFrequency(Double.valueOf(labelFrequency));
            }
            String labelOffset = axisElement.attributeValue("labelOffset");
            if (StringUtils.isNotEmpty(labelOffset)) {
                axis.setLabelOffset(Integer.valueOf(labelOffset));
            }
            String labelsEnabled = axisElement.attributeValue("labelsEnabled");
            if (StringUtils.isNotEmpty(labelsEnabled)) {
                axis.setLabelsEnabled(Boolean.valueOf(labelsEnabled));
            }
            String minorTickInterval = axisElement.attributeValue("minorTickInterval");
            if (StringUtils.isNotEmpty(minorTickInterval)) {
                axis.setMinorTickInterval(Double.valueOf(minorTickInterval));
            }
            String minorTickLength = axisElement.attributeValue("minorTickLength");
            if (StringUtils.isNotEmpty(minorTickLength)) {
                axis.setMinorTickLength(Integer.valueOf(minorTickLength));
            }
            String radius = axisElement.attributeValue("radius");
            if (StringUtils.isNotEmpty(radius)) {
                axis.setRadius(radius);
            }
            String showFirstLabel = axisElement.attributeValue("showFirstLabel");
            if (StringUtils.isNotEmpty(showFirstLabel)) {
                axis.setShowFirstLabel(Boolean.valueOf(showFirstLabel));
            }
            String showLastLabel = axisElement.attributeValue("showLastLabel");
            if (StringUtils.isNotEmpty(showLastLabel)) {
                axis.setShowLastLabel(Boolean.valueOf(showLastLabel));
            }
            String startAngle = axisElement.attributeValue("startAngle");
            if (StringUtils.isNotEmpty(startAngle)) {
                axis.setStartAngle(Integer.valueOf(startAngle));
            }
            String startValue = axisElement.attributeValue("startValue");
            if (StringUtils.isNotEmpty(startValue)) {
                axis.setStartValue(Double.valueOf(startValue));
            }
            String tickAlpha = axisElement.attributeValue("tickAlpha");
            if (StringUtils.isNotEmpty(tickAlpha)) {
                axis.setTickAlpha(Double.valueOf(tickAlpha));
            }
            String tickColor = axisElement.attributeValue("tickColor");
            if (StringUtils.isNotEmpty(tickColor)) {
                axis.setTickColor(Color.valueOf(tickColor));
            }
            String tickLength = axisElement.attributeValue("tickLength");
            if (StringUtils.isNotEmpty(tickLength)) {
                axis.setTickLength(Integer.valueOf(tickLength));
            }
            String tickThickness = axisElement.attributeValue("tickThickness");
            if (StringUtils.isNotEmpty(tickThickness)) {
                axis.setTickThickness(Integer.valueOf(tickThickness));
            }
            String topText = axisElement.attributeValue("topText");
            if (StringUtils.isNotEmpty(topText)) {
                axis.setTopText(loadResourceString(topText));
            }
            String topTextBold = axisElement.attributeValue("topTextBold");
            if (StringUtils.isNotEmpty(topTextBold)) {
                axis.setTopTextBold(Boolean.valueOf(topTextBold));
            }
            String topTextColor = axisElement.attributeValue("topTextColor");
            if (StringUtils.isNotEmpty(topTextColor)) {
                axis.setTopTextColor(Color.valueOf(topTextColor));
            }
            String topTextFontSize = axisElement.attributeValue("topTextFontSize");
            if (StringUtils.isNotEmpty(topTextFontSize)) {
                axis.setTopTextFontSize(Integer.valueOf(topTextFontSize));
            }
            String topTextYOffset = axisElement.attributeValue("topTextYOffset");
            if (StringUtils.isNotEmpty(topTextYOffset)) {
                axis.setTopTextYOffset(Integer.valueOf(topTextYOffset));
            }
            String unit = axisElement.attributeValue("unit");
            if (StringUtils.isNotEmpty(unit)) {
                axis.setUnit(unit);
            }
            String unitPosition = axisElement.attributeValue("unitPosition");
            if (StringUtils.isNotEmpty(unitPosition)) {
                axis.setUnitPosition(UnitPosition.valueOf(unitPosition));
            }
            String valueInterval = axisElement.attributeValue("valueInterval");
            if (StringUtils.isNotEmpty(valueInterval)) {
                axis.setValueInterval(Integer.valueOf(valueInterval));
            }
            String usePrefixes = axisElement.attributeValue("usePrefixes");
            if (StringUtils.isNotEmpty(usePrefixes)) {
                axis.setUsePrefixes(Boolean.valueOf(usePrefixes));
            }
            chart.addAxes(axis);
        }
    }
}
Also used : JsFunction(io.jmix.charts.model.JsFunction) Element(org.dom4j.Element) ArrayList(java.util.ArrayList) GaugeAxis(io.jmix.charts.model.GaugeAxis)

Aggregations

JsFunction (io.jmix.charts.model.JsFunction)10 Element (org.dom4j.Element)6 DatePeriod (io.jmix.charts.model.date.DatePeriod)2 GaugeAxis (io.jmix.charts.model.GaugeAxis)1 Cursor (io.jmix.charts.model.cursor.Cursor)1 DateFormat (io.jmix.charts.model.date.DateFormat)1 Graph (io.jmix.charts.model.graph.Graph)1 ArrayList (java.util.ArrayList)1 FastDateFormat (org.apache.commons.lang3.time.FastDateFormat)1