Skip to content
Snippets Groups Projects
Commit 3bb31c62 authored by Sylvain Mainguy's avatar Sylvain Mainguy
Browse files

No commit message

No commit message
parent 4bfc1e72
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import java.awt.event.MouseWheelEvent; ...@@ -5,6 +5,7 @@ import java.awt.event.MouseWheelEvent;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -406,7 +407,10 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe ...@@ -406,7 +407,10 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe
@Override @Override
public void addData(Map<String, Object> dataToAdd) { public void addData(Map<String, Object> dataToAdd) {
if (data != null && dataToAdd != null) { if (data == null) {
data = new LinkedHashMap<String, Object>();
}
if (dataToAdd != null) {
data.putAll(dataToAdd); data.putAll(dataToAdd);
} }
setData(data); setData(data);
...@@ -414,9 +418,11 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe ...@@ -414,9 +418,11 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe
@Override @Override
public void removeData(List<String> idsToRemove) { public void removeData(List<String> idsToRemove) {
if (data != null) {
for (String id : idsToRemove) { for (String id : idsToRemove) {
data.remove(id); data.remove(id);
} }
}
setData(data); setData(data);
} }
...@@ -1691,6 +1697,7 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe ...@@ -1691,6 +1697,7 @@ public class ChartViewer extends CometeComposite<Control> implements IChartViewe
ChartViewer chartViewer = new ChartViewer(shell, SWT.NONE); ChartViewer chartViewer = new ChartViewer(shell, SWT.NONE);
// mixed x and y values
double[] t1 = new double[] { 1, 5, 2, 9, 3, 12, 4, 0, 5, 23, 6, 15, 7, 10, 8, 19 }; double[] t1 = new double[] { 1, 5, 2, 9, 3, 12, 4, 0, 5, 23, 6, 15, 7, 10, 8, 19 };
double[] t2 = new double[] { 1, 6, 2, -3, 3, 0, 4, 7, 5, 54, 6, 12, 7, 34, 8, 32, 9, 31, 10, 23 }; double[] t2 = new double[] { 1, 6, 2, -3, 3, 0, 4, 7, 5, 54, 6, 12, 7, 34, 8, 32, 9, 31, 10, 23 };
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment