Comments (14)
Hi @almania69,
I'm sorry this took so long. I've tried to recreate your issue. In the example for this package, this doesn't happen for me, however (Google Chrome). I've zoomed in, resized the window, zoomed out and resized again and so on.
Could you please try the examples and tell me if you have the same problem with them?
If you've already solved the problem, I'd love to hear what was causing it.
Hope this helps,
FERNman
from angular-google-charts.
Hi @FERNman,
Unfortunately, I haven't found a solution for this yet but you can see in the GIF what I'm referring to. This happens to me on my project and the examples for this project. My thought is that there might be a loss of a reference pointer but that's just a guess at the moment. Here are the options that I'm using for the zoom too:
explorer: {
actions: ['dragToZoom', 'rightClickToReset'],
keepInBounds: true,
maxZoomIn: 4,
zoomDelta: 1
}
from angular-google-charts.
@FERNman - Adding this.wrapper.clear();
to the updateChart() function clears the chart on resizing and fixes the zoom issue but doesn't seem like a practical fix since the chart looks like it redraws the entire animations when resizing.
from angular-google-charts.
I have the same symptoms when I just update dataTable in chartData:
this.dataTable.subscribe(data => {
this.chartData = { ...this.chartData, dataTable: data };
});
Is there a way to redraw raw-chart after dataTable is updated?
from angular-google-charts.
Hi @supruniuk ,
I think the only solution to this is to redraw the chart on resize. As @almania69 pointed out, adding this.wrapper.clear();
to the updateChart()
method fixes the problem. As pointed out in this StackOverflow answer, the official GoogleCharts code also redraws the chart on resize (zooming fires the resize
event).
I don't know if the clear()
method is needed or not, but maybe enabling dynamicResize
on the RawChartComponent
is enough. If not, I'll maybe add another boolean option to the component.
Hope this helps, and if it did I'll probably close this issue for now as I don't think there's more we can do for now.
from angular-google-charts.
I ended up having to reload the data server-side based on a selection so I didn't look into a solution for this. If you don't mind redrawing the chart you can use (this.wrapper as any).clear();
which fixed the issue for me.
from angular-google-charts.
Hi @FERNman,
Could the google.charts.load('45.2', config); be set to 46 instead of 45.2?
Version 46 has a fix for this exact issue here: https://developers.google.com/chart/interactive/docs/release_notes that I still can't get around without clearing the wrapper. Or, maybe provide a string parameter to pass the chart version into the module as an injectable token?
Thanks,
Alex
from angular-google-charts.
I could implement the above fix if you don't have time and if you agree with it.
from angular-google-charts.
That's great, I didn't know Google is still releasing new versions of this package. If you want, you can implement it. Otherwise, I'll have a look at it, probably during the weekend. Should be a quick fix, and I think the idea of allowing an optional parameter is the best solution.
from angular-google-charts.
@FERNman - I have some free time so I'll jump on it right now. Should I default the version to 45.2 or 46 if no parameter is provided?
from angular-google-charts.
I think 46 is fine as long as it's not breaking anything (don't think so after reading the changelog). Please verify the demos still work and also run the tests (npm run test
). Thanks a lot for the effort again!
from angular-google-charts.
@FERNman - Okay, will do. Thanks!
from angular-google-charts.
If anyone is still having this issue then here's a fix for now until the pull request to fix this is merged.
Simply rename the scripts every load a new type of chart:
this._loaderService.onReady.subscribe(() => {
// Rename the version for the scripts
(Object.assign([], document.head.querySelectorAll('script')) as HTMLScriptElement[])
.filter(s => s.src.includes('https://www.gstatic.com/charts/45.2'))
.forEach(s => s.src = s.src.replace('45.2', '46'));
// Rename the version for the styles
(Object.assign([], document.head.querySelectorAll('link')) as HTMLLinkElement[])
.filter(s => s.href.includes('https://www.gstatic.com/charts/45.2'))
.forEach(s => s.href = s.href.replace('45.2', '46'));
})
from angular-google-charts.
The new version of angular google charts includes the PR from @almania69 , so this issue should be fixed. I'll close this now!
from angular-google-charts.
Related Issues (20)
- Push latest version to npmjs.com HOT 2
- how to clear table in the latest api? HOT 1
- New version 2.2.3 is not compatible with the current stable version of Angular (v13.2.0) HOT 8
- Angular v8. Compilation fails when importing the module. Error states: 'Please add a @NgModule annotation'
- Unable to install angular-google-charts in project
- Angular google chart Version 2.2.2 Is not working on my existing Angular 9 Application HOT 1
- Use Types interfaces in project
- GoogleChartPackagesHelper.getPackageForChartName for angular 14
- The target entry-point "angular-google-charts" has missing dependencies: - @angular/core
- Update peerDependencies for Angular 15 HOT 4
- Locale Support HOT 1
- Expand Row interface definition HOT 1
- I don't get any error but I don't see anything
- Calendar Heatmap Type Not Work dynamicResize
- Angular 16 support HOT 8
- Customize tooltip
- broaden type Row in chart-base.component.ts HOT 1
- Memory leak
- This library is unmaintained HOT 2
- Angular 18 support
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 angular-google-charts.