use of org.eclipse.swtchart.LineStyle in project swtchart by eclipse.
the class GridPage method addGridPanel.
/**
* Adds the grid panel.
*
* @param parent
* the parent to add the grid panel
*/
private void addGridPanel(Composite parent) {
Composite group = new Composite(parent, SWT.NONE);
GridData gridData = new GridData();
gridData.horizontalSpan = 2;
group.setLayoutData(gridData);
group.setLayout(new GridLayout(2, false));
createLabelControl(group, "Line style:");
LineStyle[] values = LineStyle.values();
String[] labels = new String[values.length];
for (int i = 0; i < values.length; i++) {
labels[i] = values[i].label;
}
styleCombo = createComboControl(group, labels);
styleCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String value = styleCombo.getText();
LineStyle selectedStyle = LineStyle.NONE;
for (LineStyle style : LineStyle.values()) {
if (style.label.equals(value)) {
selectedStyle = style;
}
}
styles[selectedIndex] = selectedStyle;
}
});
createLabelControl(group, "Color:");
foregroundButton = createColorButtonControl(group);
foregroundButton.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
foregroundColors[selectedIndex] = foregroundButton.getColorValue();
}
});
}
use of org.eclipse.swtchart.LineStyle in project netxms by netxms.
the class LineChart method setGridVisible.
/**
* Set grid visible
*
* @param visible true to set grid visible
*/
private void setGridVisible(boolean visible) {
final LineStyle ls = visible ? LineStyle.DOT : LineStyle.NONE;
getAxisSet().getXAxis(0).getGrid().setStyle(ls);
getAxisSet().getYAxis(0).getGrid().setStyle(ls);
}
use of org.eclipse.swtchart.LineStyle in project swtchart by eclipse.
the class SeriesPage method addLineSeriesGroup.
/**
* Adds the line series group.
*
* @param parent
* the parent to add the line series group
*/
private void addLineSeriesGroup(Composite parent) {
lineSeriesGroup = createGroupControl(parent, "Line series:", true);
stackLayout.topControl = lineSeriesGroup;
createLabelControl(lineSeriesGroup, "Line color:");
lineColorButton = createColorButtonControl(lineSeriesGroup);
lineColorButton.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
lineColors[selectedIndex] = lineColorButton.getColorValue();
}
});
createLabelControl(lineSeriesGroup, "Line style:");
LineStyle[] styles = LineStyle.values();
String[] labels = new String[styles.length];
for (int i = 0; i < styles.length; i++) {
labels[i] = styles[i].label;
}
lineStyleCombo = createComboControl(lineSeriesGroup, labels);
lineStyleCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String value = lineStyleCombo.getText();
LineStyle selectedStyle = LineStyle.NONE;
for (LineStyle style : LineStyle.values()) {
if (style.label.equals(value)) {
selectedStyle = style;
}
}
lineStyles[selectedIndex] = selectedStyle;
}
});
createLabelControl(lineSeriesGroup, "Symbol color:");
symbolColorButton = createColorButtonControl(lineSeriesGroup);
symbolColorButton.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
symbolColors[selectedIndex] = symbolColorButton.getColorValue();
}
});
createLabelControl(lineSeriesGroup, "Symbol type:");
PlotSymbolType[] types = PlotSymbolType.values();
labels = new String[types.length];
for (int i = 0; i < types.length; i++) {
labels[i] = types[i].label;
}
symbolTypeCombo = createComboControl(lineSeriesGroup, labels);
symbolTypeCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String value = symbolTypeCombo.getText();
PlotSymbolType selectedType = PlotSymbolType.CIRCLE;
for (PlotSymbolType type : PlotSymbolType.values()) {
if (type.label.equals(value)) {
selectedType = type;
}
}
symbolTypes[selectedIndex] = selectedType;
}
});
createLabelControl(lineSeriesGroup, "Symbol size:");
symbolSizeSpinner = createSpinnerControl(lineSeriesGroup, 1, 10);
symbolSizeSpinner.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
symbolSizes[selectedIndex] = symbolSizeSpinner.getSelection();
}
});
}
use of org.eclipse.swtchart.LineStyle in project tracecompass by tracecompass.
the class XYChartLegendImageProvider method drawStyleLine.
private void drawStyleLine(GC gc, Color lineColor, int imageWidth, int imageHeight, @NonNull OutputElementStyle appearance) {
Color prev = gc.getForeground();
BaseXYPresentationProvider presProvider = fChartViewer.getPresentationProvider();
LineStyle lineStyle = LineStyle.valueOf((String) presProvider.getStyleOrDefault(appearance, StyleProperties.SERIES_STYLE, StyleProperties.SeriesStyle.SOLID));
if (lineStyle != LineStyle.NONE) {
gc.setForeground(lineColor);
gc.setLineWidth(((Number) presProvider.getFloatStyleOrDefault(appearance, StyleProperties.WIDTH, 1.0f)).intValue());
gc.setLineStyle(lineStyle.ordinal());
gc.drawLine(0, imageHeight / 2, imageWidth, imageHeight / 2);
gc.setForeground(prev);
}
}
Aggregations