Search in sources :

Example 1 with Axis

use of org.eclipse.rap.chartjs.Axis in project rap by entirej.

the class EJRWTLineChartRecordBlockRenderer method initialiseRenderer.

@Override
public void initialiseRenderer(EJEditableBlockController block) {
    _block = block;
    EJCoreBlockProperties blockProperties = _block.getProperties();
    options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
    options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
    options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
    options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
    options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
    xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
    EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
    Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
    options.getYAxes().clear();
    for (EJItemGroupProperties g : itemGroupProperties) {
        Axis axis = new Axis();
        options.getYAxes().add(axis);
        if (g.getRendererProperties() == null) {
            continue;
        }
        Ticks ticks = axis.getTicks();
        if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
            ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
        if (!g.getRendererProperties().isPropertyValueNull(MIN))
            ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(MAX))
            ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
            ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
            ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
            ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
        ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
    }
}
Also used : EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Ticks(org.eclipse.rap.chartjs.Ticks) EJCoreBlockProperties(org.entirej.framework.core.properties.EJCoreBlockProperties) Axis(org.eclipse.rap.chartjs.Axis) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)

Example 2 with Axis

use of org.eclipse.rap.chartjs.Axis in project rap by entirej.

the class EJRWTBarChartRecordBlockRenderer method initialiseRenderer.

@Override
public void initialiseRenderer(EJEditableBlockController block) {
    _block = block;
    EJCoreBlockProperties blockProperties = _block.getProperties();
    options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
    options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
    options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
    options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
    options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
    options.setBarPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("barPercentage", options.getBarPercentage()));
    options.setCategoryPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("categoryPercentage", options.getCategoryPercentage()));
    int barThickness = blockProperties.getBlockRendererProperties().getIntProperty("barThickness", 0);
    if (barThickness > 0)
        options.setBarThickness(barThickness);
    int maxBarThickness = blockProperties.getBlockRendererProperties().getIntProperty("maxBarThickness", 0);
    if (maxBarThickness > 0)
        options.setMaxBarThickness(maxBarThickness);
    horizontalBar = blockProperties.getBlockRendererProperties().getBooleanProperty("horizontalBar", false);
    xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
    EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
    Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
    options.getYAxes().clear();
    options.getxAxes().clear();
    for (EJItemGroupProperties g : itemGroupProperties) {
        Axis axis = new Axis();
        if (horizontalBar)
            options.getxAxes().add(axis);
        else
            options.getYAxes().add(axis);
        if (g.getRendererProperties() == null) {
            continue;
        }
        Ticks ticks = axis.getTicks();
        if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
            ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
        if (!g.getRendererProperties().isPropertyValueNull(MIN))
            ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(MAX))
            ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
            ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
            ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
            ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
        ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
    }
}
Also used : EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Ticks(org.eclipse.rap.chartjs.Ticks) EJCoreBlockProperties(org.entirej.framework.core.properties.EJCoreBlockProperties) Axis(org.eclipse.rap.chartjs.Axis) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)

Aggregations

Axis (org.eclipse.rap.chartjs.Axis)2 Ticks (org.eclipse.rap.chartjs.Ticks)2 EJCoreBlockProperties (org.entirej.framework.core.properties.EJCoreBlockProperties)2 EJItemGroupPropertiesContainer (org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)2 EJItemGroupProperties (org.entirej.framework.core.properties.interfaces.EJItemGroupProperties)2