}
public static void main(String[] args) {
try {
final Chart chart = new Chart();
chart.setManagementPanelVisible(false);
chart.setFreezePanelVisible(false);
chart.setDataViewCometeColor("data", CometeColor.RED);
chart.setAutoScale(false, IChartViewer.Y1);
chart.setAxisMinimum(0, IChartViewer.Y1);
chart.setAxisMaximum(2, IChartViewer.Y1);
chart.setAutoScale(false, IChartViewer.X);
chart.setAxisMinimum(0, IChartViewer.X);
chart.setAxisMaximum(100, IChartViewer.X);
String[] labels = new String[zoneColors.length];
double[] pos = new double[zoneColors.length];
for (int i = 0; i < zoneColors.length; i++) {
String id = "Roi" + (i + 1);
CometeColor color = ColorTool.getCometeColor(new Color(zoneColors[i]));
chart.setDataViewCometeColor(id, color);
chart.setDataViewFillStyle(id, IChartViewer.FILL_STYLE_SOLID);
chart.setDataViewMarkerCometeColor(id, color);
chart.setDataViewCometeColor(id, color);
chart.setDataViewLabelVisible(id, false);
labels[i] = Integer.toString(i + 1);
pos[i] = 5 * (i + 0.5);
}
// chart.getXAxis().setLabels(labels, pos);
Thread dataThread = new Thread(ColorTestComparator.class.getName() + ": updating rois") {
@Override
public void run() {
Map<String, Object> dataMap = new LinkedHashMap<String, Object>();
double max = Double.NEGATIVE_INFINITY;
double[] curveData = new double[200];
for (int i = 0; i <= 100; i++) {
double y = Math.random();
curveData[2 * i] = i;
curveData[2 * i + 1] = y;
if (y > max) {
max = y;
}
}
dataMap.put("Curve", curveData);
for (int i = 0; i < ColorTestComparator.zoneColors.length; i++) {
double[][] roiData = new double[2][2];
roiData[IChartViewer.X_INDEX] = new double[] { 5 * (i + 0.2), 5 * (i + 0.8) };
roiData[IChartViewer.Y_INDEX] = new double[] { max, max };
dataMap.put("Roi" + (i + 1), roiData);
}
chart.setData(dataMap);
}
};
dataThread.start();
JPanel color1Panel = new JPanel();