Fix bug where plotted series were not labelled correctly in the legend.
This commit is contained in:
parent
f19044f08d
commit
9107566b38
@ -153,7 +153,6 @@ public class SimulationPlot {
|
|||||||
Unit unit = filled.getUnit(i);
|
Unit unit = filled.getUnit(i);
|
||||||
int axis = filled.getAxis(i);
|
int axis = filled.getAxis(i);
|
||||||
String name = getLabel(type, unit);
|
String name = getLabel(type, unit);
|
||||||
this.legendItems.lineLabels.add(name);
|
|
||||||
|
|
||||||
List<String> seriesNames = Util.generateSeriesLabels(simulation);
|
List<String> seriesNames = Util.generateSeriesLabels(simulation);
|
||||||
|
|
||||||
@ -167,7 +166,7 @@ public class SimulationPlot {
|
|||||||
List<Double> plotx = thisBranch.get(domainType);
|
List<Double> plotx = thisBranch.get(domainType);
|
||||||
List<Double> ploty = thisBranch.get(type);
|
List<Double> ploty = thisBranch.get(type);
|
||||||
XYSeries series = new XYSeries(seriesNames.get(branchIndex) + ": " + name, false, true);
|
XYSeries series = new XYSeries(seriesNames.get(branchIndex) + ": " + name, false, true);
|
||||||
series.setDescription(thisBranch.getBranchName() + ": " + name);
|
series.setDescription(name);
|
||||||
int pointCount = plotx.size();
|
int pointCount = plotx.size();
|
||||||
for (int j = 0; j < pointCount; j++) {
|
for (int j = 0; j < pointCount; j++) {
|
||||||
series.add(domainUnit.toUnit(plotx.get(j)), unit.toUnit(ploty.get(j)));
|
series.add(domainUnit.toUnit(plotx.get(j)), unit.toUnit(ploty.get(j)));
|
||||||
@ -250,6 +249,8 @@ public class SimulationPlot {
|
|||||||
}
|
}
|
||||||
// Now we pull the colors for the legend.
|
// Now we pull the colors for the legend.
|
||||||
for (int j = 0; j < data[i].getSeriesCount(); j += branchCount) {
|
for (int j = 0; j < data[i].getSeriesCount(); j += branchCount) {
|
||||||
|
String name = data[i].getSeries(j).getDescription();
|
||||||
|
this.legendItems.lineLabels.add(name);
|
||||||
Paint linePaint = r.lookupSeriesPaint(j);
|
Paint linePaint = r.lookupSeriesPaint(j);
|
||||||
this.legendItems.linePaints.add(linePaint);
|
this.legendItems.linePaints.add(linePaint);
|
||||||
Shape itemShape = r.lookupSeriesShape(j);
|
Shape itemShape = r.lookupSeriesShape(j);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user