Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polished the title and the example background colors #374

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void setTitles(String chartTitle, String xAxisTitle, String yAxisTitle) {
//
IChartSettings chartSettings = getChartSettings();
chartSettings.setTitle(chartTitle);
chartSettings.setTitleVisible(true);
chartSettings.getPrimaryAxisSettingsX().setTitle(xAxisTitle);
chartSettings.getPrimaryAxisSettingsY().setTitle(yAxisTitle);
applySettings(chartSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void setChartTitles(String[] titles) {
linkedPieCharts.get(i).getChartSettings().setTitle(titles[i]);
PieChart pieChart = linkedPieCharts.get(i);
ChartSettings chartSettings = (ChartSettings)pieChart.getChartSettings();
chartSettings.setTitleVisible(true);
chartSettings.setTitleColor(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
pieChart.applySettings(chartSettings);
}
Expand Down Expand Up @@ -182,6 +183,7 @@ private void setSettings(int index) {
}
ChartSettings chartSettings = (ChartSettings)pieChart.getChartSettings();
chartSettings.setLegendVisible(false);
chartSettings.setTitleVisible(true);
chartSettings.setTitleColor(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
chartSettings.setLegendExtendedVisible(false);
chartSettings.setShowLegendMarker(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -61,11 +61,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
final Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Axis Tick Bounds");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// create bar series
IBarSeries<?> series1 = (IBarSeries<?>)chart.getSeriesSet().createSeries(SeriesType.BAR, "series");
series1.setYSeries(ySeries);
Expand Down Expand Up @@ -95,4 +97,4 @@ static public Chart createChart(Composite parent) {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -63,11 +63,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
final Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Bar Bounds");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// create bar series
IBarSeries<?> series1 = (IBarSeries<?>)chart.getSeriesSet().createSeries(SeriesType.BAR, "series 1");
series1.setYSeries(ySeries1);
Expand Down Expand Up @@ -103,4 +105,4 @@ private void setToolTipText(ISeries<?> series, int index) {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -61,15 +61,17 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Custom Paint Listener");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
ISeries<?> lineSeries = chart.getSeriesSet().createSeries(SeriesType.LINE, "line series");
lineSeries.setYSeries(ySeries);
// add paint listeners
IPlotArea plotArea = (IPlotArea)chart.getPlotArea();
IPlotArea plotArea = chart.getPlotArea();
plotArea.addCustomPaintListener(new FrontPaintListener());
plotArea.addCustomPaintListener(new BehindPaintListener());
// adjust the axis range
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -63,11 +63,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Data To Pixel Conversion");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// get Y axis
final IAxis yAxis = chart.getAxisSet().getYAxis(0);
// create line series
Expand All @@ -94,4 +96,4 @@ public boolean drawBehindSeries() {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Multi Level Pie Chart");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
ICircularSeries<?> multiLevelPie = (ICircularSeries<?>)chart.getSeriesSet().createSeries(SeriesType.PIE, "countries");
multiLevelPie.setSeries(continentLabels, continentValues);
multiLevelPie.getNodeById("Asia").addChildren(AsianCountriesLabels, AsianCountriesValues);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -63,11 +63,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
final Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Legend Bounds");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// create bar series
IBarSeries<?> series1 = (IBarSeries<?>)chart.getSeriesSet().createSeries(SeriesType.BAR, "series 1");
series1.setYSeries(ySeries1);
Expand All @@ -92,4 +94,4 @@ static public Chart createChart(Composite parent) {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -59,11 +59,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
final Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Pxiel To Data Conversion");
chart.getTitle().setText("Pixel To Data Conversion");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// get axes
final IAxis xAxis = chart.getAxisSet().getXAxis(0);
final IAxis yAxis = chart.getAxisSet().getYAxis(0);
Expand All @@ -80,4 +82,4 @@ static public Chart createChart(Composite parent) {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2020 SWTChart project.
* Copyright (c) 2008, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -63,11 +63,13 @@ public static void main(String[] args) {
* The parent composite
* @return The created chart
*/
static public Chart createChart(Composite parent) {
public static Chart createChart(Composite parent) {

// create a chart
final Chart chart = new Chart(parent, SWT.NONE);
chart.getTitle().setText("Symbol Bounds");
chart.getPlotArea().setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
chart.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// create line series
ILineSeries<?> series1 = (ILineSeries<?>)chart.getSeriesSet().createSeries(SeriesType.LINE, "series 1");
series1.setYSeries(ySeries1);
Expand Down Expand Up @@ -102,4 +104,4 @@ private void setToolTipText(ISeries<?> series, int index) {
});
return chart;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2022 SWTChart project.
* Copyright (c) 2020, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -12,9 +12,11 @@
*******************************************************************************/
package org.eclipse.swtchart.extensions.examples.charts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtchart.extensions.core.IChartSettings;
import org.eclipse.swtchart.extensions.examples.parts.ComplexPieChart;

public class ComplexPieChartExample {
Expand All @@ -27,7 +29,12 @@ public static void main(String args[]) {
shell.setSize(700, 600);
shell.setLayout(new FillLayout());
//
new ComplexPieChart(shell);
ComplexPieChart complexPieChart = new ComplexPieChart(shell);
IChartSettings chartSettings = complexPieChart.getChartSettings();
chartSettings.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundChart(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundPlotArea(display.getSystemColor(SWT.COLOR_WHITE));
complexPieChart.applySettings(chartSettings);
shell.open();
//
while(!shell.isDisposed()) {
Expand All @@ -37,4 +44,4 @@ public static void main(String args[]) {
}
display.dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Lablicate GmbH.
* Copyright (c) 2022, 2023 Lablicate GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -53,6 +53,9 @@ public static void main(String args[]) {
chartSettings.setBufferSelection(true);
chartSettings.setHorizontalSliderVisible(false);
chartSettings.setVerticalSliderVisible(false);
chartSettings.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundChart(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundPlotArea(display.getSystemColor(SWT.COLOR_WHITE));
RangeRestriction rangeRestriction = chartSettings.getRangeRestriction();
rangeRestriction.setExtendTypeX(ExtendType.ABSOLUTE);
rangeRestriction.setExtendMinX(0.5d);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static void main(String args[]) {
*/
IChartSettings chartSettings = scrollableChart.getChartSettings();
chartSettings.setTitle("Chromatogram Example");
chartSettings.setTitleVisible(true);
chartSettings.setTitleColor(display.getSystemColor(SWT.COLOR_BLACK));
chartSettings.setLegendExtendedVisible(true);
chartSettings.setBufferSelection(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 SWTChart project.
* Copyright (c) 2022, 2023 SWTChart project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand All @@ -12,12 +12,14 @@
*******************************************************************************/
package org.eclipse.swtchart.extensions.examples.charts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtchart.IAxis;
import org.eclipse.swtchart.Range;
import org.eclipse.swtchart.extensions.core.BaseChart;
import org.eclipse.swtchart.extensions.core.IChartSettings;
import org.eclipse.swtchart.extensions.core.ScrollableChart;
import org.eclipse.swtchart.extensions.examples.parts.BarSeries_1_1_Part;

Expand All @@ -32,6 +34,11 @@ public static void main(String args[]) {
shell.setLayout(new FillLayout());
//
ScrollableChart scrollableChart = new BarSeries_1_1_Part(shell);
IChartSettings chartSettings = scrollableChart.getChartSettings();
chartSettings.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundChart(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundPlotArea(display.getSystemColor(SWT.COLOR_WHITE));
scrollableChart.applySettings(chartSettings);
shell.open();
/*
* Set a fixed range.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Lablicate GmbH.
* Copyright (c) 2022, 2023 Lablicate GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -52,6 +52,9 @@ public static void main(String args[]) {
chartSettings.setTitleColor(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
chartSettings.setTitleFont(font);
chartSettings.setTitleVisible(true);
chartSettings.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundChart(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundPlotArea(display.getSystemColor(SWT.COLOR_WHITE));
disableSecondaryAxes(chartSettings.getSecondaryAxisSettingsListX());
disableSecondaryAxes(chartSettings.getSecondaryAxisSettingsListY());
scrollableChart.applySettings(chartSettings);
Expand All @@ -73,4 +76,4 @@ private static void disableSecondaryAxes(List<ISecondaryAxisSettings> secondaryA
secondaryAxisSetting.setGridLineStyle(LineStyle.NONE);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
*******************************************************************************/
package org.eclipse.swtchart.extensions.examples.charts;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtchart.extensions.core.IChartSettings;
import org.eclipse.swtchart.extensions.examples.parts.SimplePieChart;

public class SimplePieChartExample {
Expand All @@ -30,7 +32,12 @@ public static void main(String args[]) {
//
boolean doughnut = true;
boolean highlightSeries = false;
new SimplePieChart(shell, doughnut, highlightSeries);
SimplePieChart simplePieChart = new SimplePieChart(shell, doughnut, highlightSeries);
IChartSettings chartSettings = simplePieChart.getChartSettings();
chartSettings.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundChart(display.getSystemColor(SWT.COLOR_WHITE));
chartSettings.setBackgroundPlotArea(display.getSystemColor(SWT.COLOR_WHITE));
simplePieChart.applySettings(chartSettings);
shell.open();
//
while(!shell.isDisposed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ private void initialize() throws Exception {
if(highlightSeries) {
settings.setRedrawOnClick(false);
ISeriesSettings seriesSettingsHighlight = settings.getSeriesSettingsHighlight();
if(seriesSettingsHighlight instanceof ICircularSeriesSettings) {
ICircularSeriesSettings settingsHighlight = (ICircularSeriesSettings)seriesSettingsHighlight;
if(seriesSettingsHighlight instanceof ICircularSeriesSettings settingsHighlight) {
settingsHighlight.setBorderColor(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
settingsHighlight.setBorderWidth(5);
settingsHighlight.setBorderStyle(LineStyle.DOT);
Expand Down
Loading