Comments (5)
fugly workaround;
replace all ChartLoaders with ConcurrentChartLoader;
public class ConcurrentChartLoader extends ChartLoader {
private static final Queue<DelegatingLoaderRunnable> LOADING_QUEUE = new ArrayDeque<>();
public ConcurrentChartLoader(ChartPackage... packages) {
super(packages);
}
@Override
public void loadApi(Runnable callback) {
doLoadApi(this, callback);
}
protected void doLoadApi(ConcurrentChartLoader loader, Runnable callback) {
// @see https://github.com/google/gwt-charts/issues/66
if (LOADING_QUEUE.isEmpty()) {
LOADING_QUEUE.add(new DelegatingLoaderRunnable(callback, loader));
final Runnable delegatingCallback = new Runnable() {
@Override
public void run() {
try {
LOADING_QUEUE.poll().run();
} finally {
final DelegatingLoaderRunnable peek = LOADING_QUEUE.peek();
if (peek != null) {
peek.loader.doLoadApi(this);
}
}
}
};
doLoadApi(delegatingCallback);
} else {
LOADING_QUEUE.add(new DelegatingLoaderRunnable(callback, loader));
}
}
protected void doLoadApi(Runnable callback) {
super.loadApi(callback);
}
protected static class DelegatingLoaderRunnable implements Runnable {
private final Runnable delegate;
private final ConcurrentChartLoader loader;
public DelegatingLoaderRunnable(Runnable delegate, ConcurrentChartLoader loader) {
this.delegate = delegate;
this.loader = loader;
}
@Override
public void run() {
delegate.run();
}
}
}
from gwt-charts.
Looks like this is possibly a duplicate/regression of #58 .
from gwt-charts.
Hello @ccrvincent
I am facing the same issue, and it is really annoying. I have two pie Charts which are generated at the same tame woth 2 data sources and only one gets painted.
Could you please provide some hints of your solution? I have trying to make it work using GoogleApiLoader with no success...
Thanks in advance!
Saรบl
from gwt-charts.
I no longer have access to the codebase where I was using this, so this is totally off of memory.
I wrote a class that either extended or wrapped ChartLoader and used it to manage the callbacks myself. Something like this (VERY loose psuedocode):
load(callback) {
if (!loaded) {
queue.add(callback);
if (!loading) {
ChartLoader.dowhateveritneedstodo(getLocalCallback());
loading = true;
}
} else {
callback.run();
}
}
LocalCallback.run() {
loaded = true;
for (callback : queue) {
callback.run();
}
}
GoogleApiLoader was only referenced here as an example of how to manage the loader. I never used it directly with gwt-charts.
from gwt-charts.
Thank you very much @ccrvincent for your support and effort looking for this in your memory. I will give a try.
Again, thanks a lot :)
from gwt-charts.
Related Issues (20)
- Setting the CandlestickChartOptions has no effect HOT 2
- dev mode 2.6 crashes HOT 1
- No support for changing size of BubbleChart points HOT 1
- Is this library still supported ? HOT 1
- Update library to the June 25, 2014 version HOT 1
- De-Selecting and redrawing in SelectHandler Callback causes selection to be re-selected HOT 1
- Missing "MotionChart" ChartPackage HOT 2
- Getting selections on MAP HOT 2
- colorAxis Not Working for Geochart HOT 2
- getImageURI() HOT 1
- ChartLayoutInterface should accept doubles instead of ints
- ApiLoader is not a singleton HOT 2
- Getting the selected value from a DateRangeFilter HOT 8
- DataView.toDataTable() is missing a return
- Fix line endings and redundant whitespaces HOT 1
- RoleType: Style role type missing. HOT 1
- ColumnFunction broken in DataViewColumn
- gwt-charts is not updated for new google api loader HOT 2
- how to draw multiple charts in a single flex table using GWT
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 gwt-charts.