use of org.cytoscape.ding.internal.charts.LabelPosition 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);
}
use of org.cytoscape.ding.internal.charts.LabelPosition 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);
}
use of org.cytoscape.ding.internal.charts.LabelPosition in project cytoscape-impl by cytoscape.
the class LineChart method getLayers.
@Override
public List<LineLayer> 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 Map<String, List<Double>> data = getData(network, model);
if (domainLabels.isEmpty() && data.size() == 1)
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 boolean showItemLabels = 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 lineWidth = get(LINE_WIDTH, Float.class, 1.0f);
LineLayer layer = new LineLayer(data, itemLabels, domainLabels, rangeLabels, showItemLabels, showDomainAxis, showRangeAxis, showRangeZeroBaseline, itemFontSize, domainLabelPosition, colors, axisWidth, axisColor, axisFontSize, range, lineWidth, bounds);
return Collections.singletonList(layer);
}
Aggregations