Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #60, resolves #141
Personally, I believe that the current
autoResize
implementation is incorrect. Currently, theresize()
function on the echarts instance is only called if the windowresize
event is fired. If I setautoResize
to true, I would expect the graph to resize whenever its container size is changed, not only when the window is resized.Moreover, even when the window is resized, there is no guarantee that the chart container needs to be resized, causing needless calls to the
resize
function. What we should actually be doing is checking when the surrounding container is resized as this is a much more reliable indicator that we need to resize and redraw the graph.@xieziyu has previously justified this behaviour in #60 by saying (roughly translated) "the size change of the container is usually caused by some human factor. That is to say, the code should know when the container change will occur.", but I don't think it is reasonable to expect every other component on the page which could potentially cause the graph container to change size to directly call the resize event on the echarts instance. This behaviour should be handled in the chart component directly.
Please let me know what you think, as I think the behaviour shown here is a big improvement over the current implementation.