Skip to content

Commit 5ecd2e0

Browse files
author
Jelte Lagendijk
committed
onAnimationComplete added, used for exporting images
1 parent 89bd834 commit 5ecd2e0

File tree

9 files changed

+39
-6
lines changed

9 files changed

+39
-6
lines changed

src/ChartJS/widgets/BarChart/widget/BarChart.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ define([
160160
scaleLineWidth : this.scaleLineWidth,
161161

162162
//The scale line color
163-
scaleLineColor : this.scaleLineColor
163+
scaleLineColor : this.scaleLineColor,
164+
165+
animation: {
166+
onComplete: lang.hitch(this, this._animationComplete)
167+
}
164168
})
165169
};
166170

src/ChartJS/widgets/Core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ define([
6666
_legendNode: null,
6767
_mxObj: null,
6868
_handle: null,
69+
_dataURL: "",
6970

7071
_chartType: null,
7172

@@ -662,6 +663,11 @@ define([
662663
if (cb && typeof cb === "function") {
663664
cb();
664665
}
666+
},
667+
668+
_animationComplete: function () {
669+
logger.debug(this.id + "._animationComplete");
670+
// Use this.canvasNode.toDataURL() to get an image
665671
}
666672

667673
});

src/ChartJS/widgets/DoughnutChart/widget/DoughnutChart.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ define([
127127
legendCallback : this._legendAlternateCallback,
128128

129129
//Number - The percentage of the chart that we cut out of the middle
130-
cutoutPercentage : this.percentageInnerCutout
130+
cutoutPercentage : this.percentageInnerCutout,
131+
132+
animation: {
133+
onComplete: lang.hitch(this, this._animationComplete)
134+
}
131135
})
132136
});
133137

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ define([
203203
scaleLineWidth : this.scaleLineWidth,
204204

205205
//The scale line color
206-
scaleLineColor : this.scaleLineColor
206+
scaleLineColor : this.scaleLineColor,
207+
208+
animation: {
209+
onComplete: lang.hitch(this, this._animationComplete)
210+
}
207211
})
208212
};
209213

src/ChartJS/widgets/PieChart/widget/PieChart.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ define([
133133
//cutOut of pie
134134
cutoutPercentage : 0, //always zero for Pie chart
135135

136+
animation: {
137+
onComplete: lang.hitch(this, this._animationComplete)
138+
}
136139
})
137140
};
138141
this._chart = new this._chartJS(this._ctx, chartProperties);

src/ChartJS/widgets/PolarChart/widget/PolarChart.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ define([
170170
showTooltips : this.showTooltips,
171171

172172
// Custom tooltip?
173-
customTooltips : false //lang.hitch(this, this.customTooltip)
173+
customTooltips : false, //lang.hitch(this, this.customTooltip)
174+
175+
animation: {
176+
onComplete: lang.hitch(this, this._animationComplete)
177+
}
174178

175179
}
176180
});

src/ChartJS/widgets/RadarChart/widget/RadarChart.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ define([
170170
//Boolean - Whether to fill the dataset with a colour
171171
datasetFill : this.datasetFill,
172172

173-
legendCallback : this._legendCallback
173+
legendCallback : this._legendCallback,
174+
175+
animation: {
176+
onComplete: lang.hitch(this, this._animationComplete)
177+
}
174178
})
175179
});
176180

src/ChartJS/widgets/StackedBarChart/widget/StackedBarChart.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ define([
168168
scaleLineWidth : this.scaleLineWidth,
169169

170170
//The scale line color
171-
scaleLineColor : this.scaleLineColor
171+
scaleLineColor : this.scaleLineColor,
172+
173+
animation: {
174+
onComplete: lang.hitch(this, this._animationComplete)
175+
}
172176
})
173177
};
174178

test/widgets/ChartJS.mpk

271 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)