Skip to content

Commit c9ce3f5

Browse files
author
Jelte Lagendijk
committed
Fix #73 Chart Animation Rendering stucks
1 parent 2327027 commit c9ce3f5

File tree

10 files changed

+43
-1
lines changed

10 files changed

+43
-1
lines changed

src/ChartJS/widgets/BarChart/BarChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
<category>Appearance</category>
4848
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
4949
</property>
50+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
51+
<caption>Animation</caption>
52+
<category>Appearance</category>
53+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
54+
</property>
5055
<!-- Data Source -->
5156
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
5257
<caption>Chart Entity</caption>

src/ChartJS/widgets/Core.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,20 @@ define([
7171
// Activate chartJS.
7272
this._chartJS = _charts.noConflict();
7373

74+
console.log(this._chartJS);
75+
7476
// Fonts
7577
this._font = this.labelFont || "Helvetica Neue";
7678

7779
// Hack to fix the tooltip event, also added "mouseover"
7880
this._chartJS.defaults.global.tooltipEvents = ["mouseover", "mouseup", "mousedown", "mousemove", "touchstart", "touchmove", "mouseout"];
7981
this._chartJS.defaults.global.tooltipXOffset = 0;
8082

83+
if (!this.chartAnimation) {
84+
this._chartJS.defaults.global.animation.duration = 0;
85+
}
86+
87+
8188
// Set object , dataset and datapoint.
8289
this._dataset = this.datasetentity.split("/")[0];
8390
this._datapoint = this.datapointentity && this.datapointentity.split("/")[0];
@@ -136,7 +143,7 @@ define([
136143
guid: this._mxObj.getGuid(),
137144
callback: lang.hitch(this, this._loadData)
138145
});
139-
146+
140147
// Load data again.
141148
this._loadData();
142149
domStyle.set(this.domNode, "display", "");

src/ChartJS/widgets/DoughnutChart/DoughnutChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<category>Appearance</category>
3838
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
3939
</property>
40+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
41+
<caption>Animation</caption>
42+
<category>Appearance</category>
43+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
44+
</property>
4045
<!-- Data Source -->
4146
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
4247
<caption>Chart Entity</caption>

src/ChartJS/widgets/LineChart/LineChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
<category>Appearance</category>
5555
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
5656
</property>
57+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
58+
<caption>Animation</caption>
59+
<category>Appearance</category>
60+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
61+
</property>
5762
<!-- Data Source -->
5863
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
5964
<caption>Chart Entity</caption>

src/ChartJS/widgets/PieChart/PieChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
<category>Appearance</category>
4141
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
4242
</property>
43+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
44+
<caption>Animation</caption>
45+
<category>Appearance</category>
46+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
47+
</property>
4348
<!-- Data Source -->
4449
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
4550
<caption>Chart Entity</caption>

src/ChartJS/widgets/PolarChart/PolarChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
<caption>Responsive animation duration</caption>
3737
<category>Appearance</category>
3838
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
39+
</property>
40+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
41+
<caption>Animation</caption>
42+
<category>Appearance</category>
43+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
3944
</property>
4045
<!-- Data Source -->
4146
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">

src/ChartJS/widgets/RadarChart/RadarChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<category>Appearance</category>
3838
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
3939
</property>
40+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
41+
<caption>Animation</caption>
42+
<category>Appearance</category>
43+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
44+
</property>
4045
<!-- Data Source -->
4146
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
4247
<caption>Chart Entity</caption>

src/ChartJS/widgets/StackedBarChart/StackedBarChart.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
<category>Appearance</category>
4848
<description>Animation duration (milliseconds) for responsive resizing. (Note: When implementing multiple charts, there can be problems with rendering. You can set this to 0 when having problems)</description>
4949
</property>
50+
<property key="chartAnimation" type="boolean" required="true" defaultValue="true">
51+
<caption>Animation</caption>
52+
<category>Appearance</category>
53+
<description>Switch animation on and off. Try to switch it off when you have rendering problems with multiple charts on a page</description>
54+
</property>
5055
<!-- Data Source -->
5156
<property key="sourceentity" type="entity" required="true" allowNonPersistableEntities="true">
5257
<caption>Chart Entity</caption>

test/[Test] ChartJS.mpr

16 KB
Binary file not shown.

test/widgets/ChartJS.mpk

501 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)