Skip to content

Commit

Permalink
BoxAndWhisker charts first version
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe Caillou committed Apr 14, 2022
1 parent 4243f84 commit 028025d
Show file tree
Hide file tree
Showing 5 changed files with 638 additions and 5 deletions.
2 changes: 1 addition & 1 deletion msi.gama.application/plugin.xml
Expand Up @@ -15,7 +15,7 @@
</property>
<property
name="aboutText"
value="GAMA Platform - V1.8.2 http://gama-platform.org&#x0A;&#x0A;(c) 2007-2008 IRD-UR GEODES (France) &amp; IFI-MSI (Vietnam)&#x0A;(c) 2009-2011 UMI 209 UMMISCO IRD/UPMC - MSI (Vietnam)&#x0A;(c) 2012-2017 UMI 209 UMMISCO IRD/UPMC &amp; Partners&#x0A;(c) 2018-2022 UMI 209 UMMISCO IRD/SU &amp; Partners">
value="GAMA Platform - V1.8.2 http://gama-platform.org&#x0A;&#x0A;(c) 2007-2008 IRD-UR GEODES (France) &amp; IFI-MSI (Vietnam)&#x0A;(c) 2009-2011 UMI 209 UMMISCO IRD/UPMC - MSI (Vietnam)&#x0A;(c) 2012-2017 UMI 209 UMMISCO IRD/UPMC &amp; Partners&#x0A;(c) 2018-2021 UMI 209 UMMISCO IRD/SU &amp; Partners">
</property>
<property
name="aboutImage"
Expand Down
Expand Up @@ -394,6 +394,64 @@ private Object getlistvalue(final IScope scope, final HashMap barvalues, final S
return o;

}

/**
* Addxbwvalue.
*
* @param scope the scope
* @param dx the dx
* @param dmean the dmean
* @param dmed the dmed
* @param d25 the d25
* @param d75 the d75
* @param dmin the dmin
* @param dmax the dmax
* @param date the date
* @param barvalues the barvalues
* @param listvalue the listvalue
*/
public void addcbwvalue(final IScope scope, final String dx, final double dmean, final double dmed,final double d25, final double d75, final double dmin, final double dmax, final int date,
final HashMap barvalues, final int listvalue) {

cvalues.add(dx);
yvalues.add(dmean);
svalues.add(dmed);
xerrvaluesmin.add(d25);
xerrvaluesmax.add(d75);
yerrvaluesmin.add(dmin);
yerrvaluesmax.add(dmax);
if (barvalues.containsKey(IKeyword.COLOR)) {
final Object o = getlistvalue(scope, barvalues, IKeyword.COLOR, listvalue);
if (o != null) {
if (o instanceof IList) {
final IList ol = Cast.asList(scope, o);
if (ol.size() == 1) {
this.setMycolor(Cast.asColor(scope, ol.get(0)));
}
if (ol.size() == 2) {
this.setMycolor(Cast.asColor(scope, ol.get(1)));
this.setMyMincolor(Cast.asColor(scope, ol.get(0)));
}
if (ol.size() > 2) {
this.setMyMincolor(Cast.asColor(scope, ol.get(0)));
this.setMyMedcolor(Cast.asColor(scope, ol.get(1)));
this.setMycolor(Cast.asColor(scope, ol.get(2)));
}
} else {
final GamaColor col = Cast.asColor(scope, o);
this.setMycolor(col);

}
}

}
this.getDataset().serieToUpdateBefore.put(this.getName(), date);

}





/**
* Addxysvalue.
Expand Down
Expand Up @@ -151,6 +151,9 @@ public class ChartDataSource {
/** The use marker shape exp. */
boolean useMarkerShapeExp = false;

/** Is Box and whisker. */
boolean isBoxAndWhiskerData = false;

/** The line thickness. */
double lineThickness = 1.0;

Expand Down Expand Up @@ -193,6 +196,8 @@ public boolean cloneMe(final IScope scope, final int chartCycle, final ChartData
useColorExp = source.useColorExp;
useMarkerShapeExp = source.useMarkerShapeExp;
lineThickness = source.lineThickness;
isBoxAndWhiskerData = source.isBoxAndWhiskerData;


return true;
}
Expand Down Expand Up @@ -264,6 +269,15 @@ public void setUseSize(final boolean useSize) {
this.useSize = useSize;
}

public boolean isBoxAndWhiskerData() {
return isBoxAndWhiskerData;
}

public void setisBoxAndWhiskerData(final boolean isBoxAndWhiskerData) {
this.isBoxAndWhiskerData = isBoxAndWhiskerData;
}


/**
* Sets the line thickness.
*
Expand Down Expand Up @@ -831,11 +845,18 @@ void updateseriewithvalue(final IScope scope, final ChartDataSeries myserie, fin
myserie.addcyvalue(scope, getDataset().getLastCategories(scope),
Cast.asFloat(scope, lvalue.get(0)), chartCycle, barvalues, listvalue);
}
if (lvalue.length(scope) > 1) {
if (lvalue.length(scope) > 1 && (lvalue.length(scope) < 6 || !this.isBoxAndWhiskerData())) {
myserie.addcysvalue(scope, getDataset().getLastCategories(scope),
Cast.asFloat(scope, lvalue.get(0)), Cast.asFloat(scope, lvalue.get(1)),
chartCycle, barvalues, listvalue);
}
if (lvalue.length(scope) > 5 && this.isBoxAndWhiskerData()) {
myserie.addcbwvalue(scope, getDataset().getLastCategories(scope),
Cast.asFloat(scope, lvalue.get(0)), Cast.asFloat(scope, lvalue.get(1)),
Cast.asFloat(scope, lvalue.get(2)), Cast.asFloat(scope, lvalue.get(3)),
Cast.asFloat(scope, lvalue.get(4)), Cast.asFloat(scope, lvalue.get(5)),
chartCycle, barvalues, listvalue);
}
break;

}
Expand Down Expand Up @@ -892,11 +913,18 @@ void updateseriewithvalue(final IScope scope, final ChartDataSeries myserie, fin
Cast.asFloat(scope, lvalue.get(0)), chartCycle, barvalues, listvalue);

}
if (lvalue.length(scope) > 1) {
if (lvalue.length(scope) > 1 && (lvalue.length(scope) < 6 || !this.isBoxAndWhiskerData())) {
myserie.addcysvalue(scope, getDataset().getCategories(scope, n1),
Cast.asFloat(scope, lvalue.get(0)), Cast.asFloat(scope, lvalue.get(1)),
chartCycle, barvalues, listvalue);
}
if (lvalue.length(scope) > 5 && this.isBoxAndWhiskerData()) {
myserie.addcbwvalue(scope, getDataset().getCategories(scope, n1),
Cast.asFloat(scope, lvalue.get(0)), Cast.asFloat(scope, lvalue.get(1)),
Cast.asFloat(scope, lvalue.get(2)), Cast.asFloat(scope, lvalue.get(3)),
Cast.asFloat(scope, lvalue.get(4)), Cast.asFloat(scope, lvalue.get(5)),
chartCycle, barvalues, listvalue);
}

}
break;
Expand Down
Expand Up @@ -145,11 +145,14 @@ public static ChartJFreeChartOutput createChartOutput(final IScope scope, final
newChart = new ChartJFreeChartOutputPie(scope, name, typeexp);
break;
}
case HISTOGRAM_CHART:
case BOX_WHISKER_CHART: {
case HISTOGRAM_CHART:{
newChart = new ChartJFreeChartOutputHistogram(scope, name, typeexp);
break;
}
case BOX_WHISKER_CHART: {
newChart = new ChartJFreeChartOutputBoxAndWhiskerCategory(scope, name, typeexp);
break;
}
case RADAR_CHART: {
newChart = new ChartJFreeChartOutputRadar(scope, name, typeexp);
break;
Expand Down

0 comments on commit 028025d

Please sign in to comment.