yui / yui3

A library for building richly interactive web applications.
http://yuilibrary.com/
Other
4.12k stars 1.29k forks source link

Line charts sometimes display nothing #1056

Open wecing opened 11 years ago

wecing commented 11 years ago

Here's the source code of my demo: https://gist.github.com/wecing/6134963

When you:

  1. feed the chart with very large numbers,
  2. re-render, then
  3. repeat step 1 but with very small numbers, and finally
  4. re-render again, the chart would display nothing.
tripp commented 11 years ago

It looks like the #1079 may cause potential performance hits with some use cases. The fix will have to wait until the next sprint so that I can investigate and apply a performance neutral fix. In the interim, you can patch this issue by setting the graphic instance's resizeDown attribute to true before updating the dataProvider.

            var chart = new Y.Chart({
                type: 'line',
                dataProvider: myDataValues,
                render: "#chart-div"
            });
            chart.get("graph").get("graphic").set("resizeDown", true);

Thanks.

wecing commented 11 years ago

Thanks.

BTW, it seems that resizeDown should not be set to true before first-time-rendering is done. So for those who is still using an old version of YUI which doesn't have a fix for this issue(or if the patch is not ready yet, like now) and do not supply an initial dataProvider field when creating the chart object, it's better to add that hot fix line after render().