Skip to content

Commit 828e8e1

Browse files
author
Jelte Lagendijk
committed
Merge branch 'Mcpoowl-master'
# Conflicts: # src/ChartJS/widgets/Core.js # test/widgets/ChartJS.mpk
2 parents 7fad1a2 + 2e8b31a commit 828e8e1

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ChartJS",
3-
"version": "3.1.3",
3+
"version": "3.1.4",
44
"description": "This widget is a wrapper for the ChartJS library and you can use it to visualize your aggregated data.",
55
"license": "Apache License, Version 2",
66
"author": "Mendix",
@@ -30,4 +30,4 @@
3030
"scripts": {
3131
"test": "grunt test"
3232
}
33-
}
33+
}

src/ChartJS/widgets/Core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ define([
6161

6262
startup: function () {
6363
// Uncomment line to start debugging
64-
logger.level(logger.DEBUG);
64+
//logger.level(logger.DEBUG);
6565
logger.debug(this.id + ".startup");
6666

6767
var domNode = null;

src/ChartJS/widgets/LineChart/LineChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
<category>Appearance</category>
1515
<description>Initial width of the chart canvas, will be ignored when responsive property is set to 'Yes'</description>
1616
</property>
17+
<property key="isStacked" type="boolean" required="true" defaultValue="false">
18+
<caption>Stacked</caption>
19+
<category>Appearance</category>
20+
<description>When yes, different dataset will stack on top of eachother on the Y-axis</description>
21+
</property>
1722
<property key="height" type="integer" required="true" defaultValue="250">
1823
<caption>Height</caption>
1924
<category>Appearance</category>

src/ChartJS/widgets/LineChart/widget/LineChart.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ define([
8080

8181
_set = {
8282
label : (this.scaleShowLabelsBottom === true) ? label : "",
83-
backgroundColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.2") : this._hexToRgb(color, "0.2"),
83+
backgroundColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.2") : color,
8484
borderColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.5") : color,
8585
pointColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.8") : color,
8686
pointBorderColor: (this.seriesColorReduceOpacity) ? this._hexToRgb(color, "0.8") : color,
@@ -110,18 +110,25 @@ define([
110110
_createChart : function (data) {
111111
logger.debug(this.id + "._createChart");
112112

113+
113114
if (this._chart) {
114115
this._chart.stop();
115116
this._chart.data.datasets = data.datasets;
116117
this._chart.data.labels = data.labels;
117118
this._chart.update(1000);
118119
this._chart.bindEvents(); // tooltips otherwise won't work
119120
} else {
120-
121+
logger.debug("stacked:" + this.isStacked);
121122
this._chart = new this._chartJS(this._ctx, {
122123
type: "line",
123124
data: data,
124125
options: {
126+
scales : {
127+
yAxes: [{
128+
//If stacked is set to true, the Y-axis needs to be stacked for it to work
129+
stacked: this.isStacked
130+
}]
131+
},
125132

126133
responsive : this.responsive,
127134
responsiveAnimationDuration : (this.responsiveAnimationDuration > 0 ? this.responsiveAnimationDuration : 0),
@@ -151,6 +158,9 @@ define([
151158
//Boolean - Whether to show vertical lines (except Y axis)
152159
scaleShowVerticalLines : this.scaleShowVerticalLines,
153160

161+
//Boolean - Whether or not to render as a stacked chart
162+
stacked : this.isStacked,
163+
154164
//Boolean - Whether to show a dot for each point
155165
pointDot : this.pointDot,
156166

src/package.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="ChartJS" version="3.1.3" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="ChartJS" version="3.1.4" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="ChartJS/widgets/BarChart/BarChart.xml"/>
66
<widgetFile path="ChartJS/widgets/LineChart/LineChart.xml"/>
@@ -20,4 +20,4 @@
2020
<file path="ChartJS/widgets/DoughnutChart/widget/"/>
2121
</files>
2222
</clientModule>
23-
</package>
23+
</package>

0 commit comments

Comments
 (0)