Comments (6)
Hi,
You're right!
If you take a look at line 52 of highcharts-vue/src/component.js
you'll find that 2 additional arguments are passed to chart.update(config, true, true)
.
As you can read in the API (https://api.highcharts.com/class-reference/Highcharts.Chart#update), the third argument is oneToOne
which determines if the series
is updated from the config passed to chart.update
or not. The Highcharts-Vue
wrapper makes all updates based on props changes with oneToOne = true
Here's how it works for a normal chart: https://jsfiddle.net/BlackLabel/pwnm93gj/
However, I've taken a closer look to what happens to mapChart
and you're right - it seems to be a bug. I've reported it here: highcharts/highcharts#18648
So until it gets solved, I would recommend you use series.mapData
instead of chart.map
when you perform an update on the chart. Here's a demo: https://jsfiddle.net/BlackLabel/6gtxfrz9/
Let me know if you have any more questions!
from highcharts-vue.
Hi,
Thanks for the question!
I understand your question, but it is not related to the Highcharts-Vue
wrapper, it's just how Highcharts works.
It doesn't seem to work in with Vanilla JS in either normal charts: https://jsfiddle.net/BlackLabel/xny05arq/ nor map charts: https://jsfiddle.net/BlackLabel/ekbm2qnh/
As you can read in the API (https://api.highcharts.com/class-reference/Highcharts.Chart#update):
A special case is configuration objects that take arrays, for example xAxis, yAxis or series.
So chart.update
works for updating the chart config, but does not work for adding/modifying series. That's why nothing shows up in your demo.
I'd recommend you use chart.addSeries()
to add a new series to the chart on mounted()
.
Demo for a standard chart: https://jsfiddle.net/BlackLabel/bv59r8ze/
Demo for a map chart: https://jsfiddle.net/BlackLabel/3a756quz/
Let me know if that helps!
from highcharts-vue.
Hi,
It's interesting, the vanilla js demos you provided match the below concept
So chart.update works for updating the chart config, but does not work for adding/modifying series. That's why nothing shows up in your demo.
and seems it also matches the explanation for the special cases from https://api.highcharts.com/class-reference/Highcharts.Chart#update
Then, a new question, is the chart updating logic behind highcharts-vue wrapper <highcharts></highcharts>
completely equal to Highchart.chart.update() when the :options
prop is changed?
I will give it a question mark for now, coz I got a few 'highcharts-vue' wrapper-based demos to show you.
Here are the links
1.https://codesandbox.io/s/cranky-mclaren-dts4ju?file=/src/components/Chart.vue:0-419 (line chart)
2.https://codesandbox.io/s/intelligent-ardinghelli-v630i3?file=/src/components/Chart.vue:0-458 (pie chart)
3.https://codesandbox.io/s/determined-snow-rso769?file=/src/components/Chart.vue (stock chart)
For these demos, they all have a chartOptions state with the default value - chartOptions: { }
, and after loading/fetching in the mounted(), a new non-empty chart option will be assigned to the state, basically the same logic to the first failed map demo I showed above (https://codesandbox.io/s/sweet-sammet-s42sp1?file=/src/components/Chart.vue), but they all have the expected charts showed instead of failed rendering.
So I feel the test results have some conflicts with the concept you mentioned, and it only happens to the map chart.
What's your opinion on this?
from highcharts-vue.
Closed as it will be solved within the Highcharts repo.
from highcharts-vue.
Hi,
Thank you for your response and recommendation.
What I wanted was to share some of my findings that might confuse highchart-vue users when they're using this wrapper to create a mapChart. With the above demos and our discussion, I think highchart-vue users will have a better understanding of creating mapChart via this wrapper when they find this issue content.
I also found another alternative which is different to your recommendation. I will share it here.
https://codesandbox.io/s/nice-silence-lepkj6?file=/src/components/Chart.vue
Anyone who is interested in it could compare it with the above failed one (https://codesandbox.io/s/sweet-sammet-s42sp1?file=/src/components/Chart.vue).
from highcharts-vue.
Thank you for your detailed descriptions!
We appreciate that.
Feel free to post any questions on our forum or GitHub if they arise.
from highcharts-vue.
Related Issues (20)
- How to use networkgraph in vue-highcharts HOT 2
- Bug with updating values HOT 2
- Chart object inaccessible since 1.4.1 HOT 6
- NPM version is updated to 1.4.1 but not in releases HOT 4
- Chart data update alters mouse hover behavior HOT 3
- Support for Dashboards HOT 1
- How to add custom series type for stock HOT 2
- Demo app fails to build HOT 1
- Highchart is not scaled correctly HOT 2
- Update doc to install HV globally as a plugin? HOT 3
- scrollablePlotArea not rendering lines but markers show on areas beyond width highcharts-vue v1.3.5 highcharts 8.1.1 HOT 8
- Insufficient check before calling .destroy() HOT 5
- Problem with using module exporting and highcharts-more in composition API vue 3 and with script setup HOT 3
- webpack failing since highcharts 11.2.0 HOT 11
- Query: Display days and month headings in Gantt style chart HOT 1
- demo_vue3 undable to run HOT 2
- Upgrading to Vue 3.4.5 breaks the charts HOT 14
- Charts ar broken in Vue.js DEV mode HOT 4
- issue with types in 2.0.0 HOT 10
- Issue with flamechart in Vue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from highcharts-vue.