Skip to content

Commit 0087176

Browse files
author
Mike Schultz
committed
Fixes the id property, and adds the forceRender property to work with dynamic scalable axis
1 parent 06a2230 commit 0087176

9 files changed

+78
-30
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ The theme or 'defaults' object defined by ZingChart. More information available
258258
### modules [string or array] (optional)
259259
An option to add the name of modules being loaded, into ZingChart's render object. Necessary for certain modules including the 'scalableYAxis'.
260260

261+
### forceRender
262+
The addition of this property will force ZingChart to re-render on all configuration changes. This isn't optimally performant, but some ZingChart features will require a full re-render of the chart, rather than an internal data update change. Only use this option when necessary.
263+
261264

262265
## Events
263266

ZingChart.vue

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export default {
2929
type: [String, Number],
3030
default: DEFAULT_HEIGHT,
3131
},
32+
id: {
33+
type: [String],
34+
required: false,
35+
},
3236
output: {
3337
type: String,
3438
default: DEFAULT_OUTPUT,
@@ -48,14 +52,19 @@ export default {
4852
modules: {
4953
type: [String, Array],
5054
required: false
55+
},
56+
forceRender: {
57+
type: String,
5158
}
5259
},
5360
data() {
5461
return {
5562
chartId: null,
5663
instance: null,
64+
forceRenderOnChange: false,
5765
EVENT_NAMES,
5866
METHOD_NAMES,
67+
renderObject: null,
5968
};
6069
},
6170
destroyed() {
@@ -77,6 +86,7 @@ export default {
7786
},
7887
methods: {
7988
render() {
89+
this.forceRenderOnChange = typeof this.$props.forceRender !== 'undefined';
8090
this.$el.style.width = this.$props.width;
8191
this.$el.style.height = this.$props.height;
8292
// Set the id for zingchart to render to
@@ -87,19 +97,19 @@ export default {
8797
}
8898
this.$refs.chart.setAttribute('id', this.chartId);
8999
90-
const renderObject = {
100+
this.renderObject = {
91101
id: this.chartId,
92102
data: this.chartData,
93103
height: this.$props.height,
94104
width: this.$props.width,
95105
output: this.$props.output,
96106
};
97107
if(this.$props.modules) {
98-
renderObject.modules = this.$props.modules;
108+
this.renderObject.modules = this.$props.modules;
99109
}
100110
101111
if(this.$props.theme) {
102-
renderObject.defaults = this.$props.theme;
112+
this.renderObject.defaults = this.$props.theme;
103113
}
104114
105115
// Pipe zingchart specific event listeners
@@ -113,7 +123,7 @@ export default {
113123
});
114124
115125
// Render the chart
116-
window.zingchart.render(renderObject);
126+
window.zingchart.render(this.renderObject);
117127
118128
// Apply all of ZingChart's methods directly to the Vue instance
119129
this.METHOD_NAMES.forEach(name => {
@@ -133,9 +143,14 @@ export default {
133143
},
134144
watch: {
135145
data: function() {
136-
window.zingchart.exec(this.chartId, 'setdata', {
137-
data: this.chartData,
138-
});
146+
if(this.forceRenderOnChange) {
147+
this.renderObject.data = this.chartData;
148+
window.zingchart.render(this.renderObject);
149+
} else {
150+
window.zingchart.exec(this.chartId, 'setdata', {
151+
data: this.chartData,
152+
});
153+
}
139154
},
140155
height: function() { this.resize() },
141156
series: function() {

dist/zingchartVue.common.js

Lines changed: 24 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchartVue.common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchartVue.umd.js

Lines changed: 24 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchartVue.umd.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchartVue.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zingchartVue.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zingchart-vue",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "ZingChart Vue Component wrapper to allow native vue syntax for javascript charts, chart events, chart methods and chart styling.",
55
"author": "ZingSoft Inc",
66
"scripts": {

0 commit comments

Comments
 (0)