Search in sources :

Example 1 with Orientation

use of org.cytoscape.ding.customgraphics.Orientation in project cytoscape-impl by cytoscape.

the class AbstractChartEditor method updateOrientation.

protected void updateOrientation() {
    final Orientation orientation = chart.get(ORIENTATION, Orientation.class, Orientation.VERTICAL);
    final JRadioButton orientRd = orientation == Orientation.HORIZONTAL ? getHorizontalRd() : getVerticalRd();
    getOrientationGrp().setSelected(orientRd.getModel(), true);
}
Also used : JRadioButton(javax.swing.JRadioButton) Orientation(org.cytoscape.ding.customgraphics.Orientation)

Example 2 with Orientation

use of org.cytoscape.ding.customgraphics.Orientation in project cytoscape-impl by cytoscape.

the class BoxChart method getLayers.

@Override
public List<BoxLayer> getLayers(final CyNetworkView networkView, final View<? extends CyIdentifiable> view) {
    final CyNetwork network = networkView.getModel();
    final CyIdentifiable model = view.getModel();
    final boolean global = get(GLOBAL_RANGE, Boolean.class, true);
    final List<Double> range = global ? getList(RANGE, Double.class) : null;
    final Map<String, List<Double>> data = getData(network, model);
    final List<Color> colors = getColors(data);
    final double size = 32;
    final Rectangle2D bounds = new Rectangle2D.Double(-size / 2, -size / 2, size, size);
    final Orientation orientation = get(ORIENTATION, Orientation.class);
    final boolean showRangeAxis = get(SHOW_RANGE_AXIS, Boolean.class, false);
    final boolean showRangeZeroBaseline = get(SHOW_RANGE_ZERO_BASELINE, Boolean.class, false);
    final float axisWidth = get(AXIS_WIDTH, Float.class, 0.25f);
    final Color axisColor = get(AXIS_COLOR, Color.class, Color.DARK_GRAY);
    final float axisFontSize = convertFontSize(get(AXIS_LABEL_FONT_SIZE, Integer.class, 1));
    final float borderWidth = get(BORDER_WIDTH, Float.class, 0.25f);
    final Color borderColor = get(BORDER_COLOR, Color.class, Color.DARK_GRAY);
    final BoxLayer layer = new BoxLayer(data, showRangeAxis, showRangeZeroBaseline, colors, axisWidth, axisColor, axisFontSize, borderWidth, borderColor, range, orientation, bounds);
    return Collections.singletonList(layer);
}
Also used : Color(java.awt.Color) Rectangle2D(java.awt.geom.Rectangle2D) CyNetwork(org.cytoscape.model.CyNetwork) Orientation(org.cytoscape.ding.customgraphics.Orientation) List(java.util.List) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 3 with Orientation

use of org.cytoscape.ding.customgraphics.Orientation in project cytoscape-impl by cytoscape.

the class HeatMapChart method getLayers.

@Override
public List<HeatMapLayer> getLayers(final CyNetworkView networkView, final View<? extends CyIdentifiable> view) {
    final CyNetwork network = networkView.getModel();
    final CyIdentifiable model = view.getModel();
    final List<String> itemLabels = getLabelsFromColumn(network, model, get(ITEM_LABELS_COLUMN, CyColumnIdentifier.class));
    final List<String> domainLabels = getLabelsFromColumn(network, model, get(DOMAIN_LABELS_COLUMN, CyColumnIdentifier.class));
    final List<String> rangeLabels = getLabelsFromColumn(network, model, get(RANGE_LABELS_COLUMN, CyColumnIdentifier.class));
    final boolean global = get(GLOBAL_RANGE, Boolean.class, true);
    final List<Double> range = global ? getList(RANGE, Double.class) : null;
    final Map<String, List<Double>> data = getData(network, model);
    final List<Color> colors = getColors(data);
    final double size = 32;
    final Rectangle2D bounds = new Rectangle2D.Double(-size / 2, -size / 2, size, size);
    final boolean showDomainAxis = get(SHOW_DOMAIN_AXIS, Boolean.class, false);
    final boolean showRangeAxis = get(SHOW_RANGE_AXIS, Boolean.class, false);
    final LabelPosition domainLabelPosition = get(DOMAIN_LABEL_POSITION, LabelPosition.class);
    final Color axisColor = get(AXIS_COLOR, Color.class, Color.DARK_GRAY);
    final float axisFontSize = convertFontSize(get(AXIS_LABEL_FONT_SIZE, Integer.class, 1));
    final Orientation orientation = get(ORIENTATION, Orientation.class);
    final HeatMapLayer layer = new HeatMapLayer(data, itemLabels, domainLabels, rangeLabels, showDomainAxis, showRangeAxis, domainLabelPosition, colors, axisColor, axisFontSize, range, orientation, bounds);
    return Collections.singletonList(layer);
}
Also used : Color(java.awt.Color) Rectangle2D(java.awt.geom.Rectangle2D) CyNetwork(org.cytoscape.model.CyNetwork) CyColumnIdentifier(org.cytoscape.view.presentation.property.values.CyColumnIdentifier) Orientation(org.cytoscape.ding.customgraphics.Orientation) List(java.util.List) LabelPosition(org.cytoscape.ding.internal.charts.LabelPosition) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 4 with Orientation

use of org.cytoscape.ding.customgraphics.Orientation in project cytoscape-impl by cytoscape.

the class BarChart method getLayers.

// ==[ PUBLIC METHODS ]=============================================================================================
@Override
public List<BarLayer> getLayers(final CyNetworkView networkView, final View<? extends CyIdentifiable> view) {
    final CyNetwork network = networkView.getModel();
    final CyIdentifiable model = view.getModel();
    final List<String> itemLabels = getItemLabels(network, model);
    List<String> domainLabels = getLabelsFromColumn(network, model, get(DOMAIN_LABELS_COLUMN, CyColumnIdentifier.class));
    final List<String> rangeLabels = getLabelsFromColumn(network, model, get(RANGE_LABELS_COLUMN, CyColumnIdentifier.class));
    final boolean global = get(GLOBAL_RANGE, Boolean.class, true);
    final List<Double> range = global ? getList(RANGE, Double.class) : null;
    final BarChartType type = get(TYPE, BarChartType.class, BarChartType.GROUPED);
    final Map<String, List<Double>> data = getData(network, model);
    if (domainLabels.isEmpty() && data.size() == 1 && type != BarChartType.STACKED)
        domainLabels = getSingleValueColumnNames(network, model);
    final List<Color> colors = getColors(data);
    final double size = 32;
    final Rectangle2D bounds = new Rectangle2D.Double(-size / 2, -size / 2, size, size);
    final Orientation orientation = get(ORIENTATION, Orientation.class);
    final boolean showLabels = get(SHOW_ITEM_LABELS, Boolean.class, false);
    final boolean showDomainAxis = get(SHOW_DOMAIN_AXIS, Boolean.class, false);
    final boolean showRangeAxis = get(SHOW_RANGE_AXIS, Boolean.class, false);
    final boolean showRangeZeroBaseline = get(SHOW_RANGE_ZERO_BASELINE, Boolean.class, false);
    final LabelPosition domainLabelPosition = get(DOMAIN_LABEL_POSITION, LabelPosition.class);
    final float axisWidth = get(AXIS_WIDTH, Float.class, 0.25f);
    final Color axisColor = get(AXIS_COLOR, Color.class, Color.DARK_GRAY);
    final float axisFontSize = convertFontSize(get(AXIS_LABEL_FONT_SIZE, Integer.class, 1));
    final float itemFontSize = convertFontSize(get(ITEM_LABEL_FONT_SIZE, Integer.class, 1));
    final float borderWidth = get(BORDER_WIDTH, Float.class, 0.25f);
    final Color borderColor = get(BORDER_COLOR, Color.class, Color.DARK_GRAY);
    double separation = get(SEPARATION, Double.class, 0.0);
    separation = (separation > MAX_SEPARATION) ? MAX_SEPARATION : (separation < 0.0 ? 0.0 : separation);
    final BarLayer layer = new BarLayer(data, type, itemLabels, domainLabels, rangeLabels, showLabels, showDomainAxis, showRangeAxis, showRangeZeroBaseline, itemFontSize, domainLabelPosition, colors, axisWidth, axisColor, axisFontSize, borderWidth, borderColor, separation, range, orientation, bounds);
    return Collections.singletonList(layer);
}
Also used : Color(java.awt.Color) Rectangle2D(java.awt.geom.Rectangle2D) CyNetwork(org.cytoscape.model.CyNetwork) CyColumnIdentifier(org.cytoscape.view.presentation.property.values.CyColumnIdentifier) Orientation(org.cytoscape.ding.customgraphics.Orientation) List(java.util.List) LabelPosition(org.cytoscape.ding.internal.charts.LabelPosition) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 5 with Orientation

use of org.cytoscape.ding.customgraphics.Orientation in project cytoscape-impl by cytoscape.

the class AbstractChartEditor method setOrientation.

protected void setOrientation() {
    final Orientation orientation = getHorizontalRd().isSelected() ? Orientation.HORIZONTAL : Orientation.VERTICAL;
    chart.set(ORIENTATION, orientation);
}
Also used : Orientation(org.cytoscape.ding.customgraphics.Orientation)

Aggregations

Orientation (org.cytoscape.ding.customgraphics.Orientation)9 Color (java.awt.Color)7 CyColumnIdentifier (org.cytoscape.view.presentation.property.values.CyColumnIdentifier)6 AbstractCustomGraphics2Test (org.cytoscape.ding.customgraphics.AbstractCustomGraphics2Test)4 ColorScheme (org.cytoscape.ding.customgraphics.ColorScheme)4 Test (org.junit.Test)4 Rectangle2D (java.awt.geom.Rectangle2D)3 List (java.util.List)3 CyIdentifiable (org.cytoscape.model.CyIdentifiable)3 CyNetwork (org.cytoscape.model.CyNetwork)3 LabelPosition (org.cytoscape.ding.internal.charts.LabelPosition)2 JRadioButton (javax.swing.JRadioButton)1 BarChart (org.cytoscape.ding.internal.charts.bar.BarChart)1 BarChartType (org.cytoscape.ding.internal.charts.bar.BarChart.BarChartType)1 BoxChart (org.cytoscape.ding.internal.charts.box.BoxChart)1 HeatMapChart (org.cytoscape.ding.internal.charts.heatmap.HeatMapChart)1 LineChart (org.cytoscape.ding.internal.charts.line.LineChart)1