Skip to content

Commit 3b8d60a

Browse files
committed
merge png-export feature
2 parents eb52995 + 5ecd2e0 commit 3b8d60a

File tree

9 files changed

+40
-7
lines changed

9 files changed

+40
-7
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

@@ -700,6 +701,11 @@ define([
700701
if (cb && typeof cb === "function") {
701702
cb();
702703
}
704+
},
705+
706+
_animationComplete: function () {
707+
logger.debug(this.id + "._animationComplete");
708+
// Use this.canvasNode.toDataURL() to get an image
703709
}
704710

705711
});

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

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

9898
//Number - The percentage of the chart that we cut out of the middle
99-
cutoutPercentage: this.percentageInnerCutout
99+
cutoutPercentage: this.percentageInnerCutout,
100+
101+
animation: {
102+
onComplete: lang.hitch(this, this._animationComplete)
103+
}
100104
})
101105
});
102106

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ define([
211211
scaleLineWidth: this.scaleLineWidth,
212212

213213
//The scale line color
214-
scaleLineColor: this.scaleLineColor
214+
scaleLineColor: this.scaleLineColor,
215+
216+
animation: {
217+
onComplete: lang.hitch(this, this._animationComplete)
218+
}
215219
})
216220
};
217221

@@ -235,4 +239,4 @@ define([
235239
});
236240
});
237241

238-
require(["ChartJS/widgets/LineChart/widget/LineChart"]);
242+
require(["ChartJS/widgets/LineChart/widget/LineChart"]);

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

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

105+
animation: {
106+
onComplete: lang.hitch(this, this._animationComplete)
107+
}
105108
})
106109
};
107110
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
@@ -140,7 +140,11 @@ define([
140140
showTooltips : this.showTooltips,
141141

142142
// Custom tooltip?
143-
customTooltips : false //lang.hitch(this, this.customTooltip)
143+
customTooltips : false, //lang.hitch(this, this.customTooltip)
144+
145+
animation: {
146+
onComplete: lang.hitch(this, this._animationComplete)
147+
}
144148

145149
}
146150
});

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

252 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)