Skip to content
Navigation Menu
{{ message }}
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Events #45
Merged
Merged
Events #45
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,102 @@ | ||
| function addData(area, axis, setKey) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand what's going on in this functions, so cant really review it
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An event raised during selection of some area of chart. This event has |
||
| if (axis.type !== "value") { | ||
| area[setKey] = axis.data; | ||
| } else { | ||
| area[setKey] = [ ]; | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| // ECharts doesn't send x-axis data in brush events but we need it | ||
| // because sorting algo may be opaque | ||
| function addAxisData(option, e, axisKey, setKey, axisIndexKey) { | ||
| var i, j, gridIndex; | ||
| for (i = 0; i < e.areas.length; i++) { | ||
| gridIndex = parseInt(e.areas[i].panelId.match(/\d+$/g)[0]); | ||
| e.areas[i].gridIndex = gridIndex; | ||
| if (typeof option === "undefined") { | ||
| e.areas[i][setKey] = [ ]; | ||
| e.areas[i][axisIndexKey] = 0; | ||
| } else if (typeof option[axisKey].length === "undefined" && gridIndex === 0) { | ||
| addData(e.areas[i], option[axisKey], setKey); | ||
| e.areas[i][axisIndexKey] = 0; | ||
| } else if (option[axisKey].length === 1 && gridIndex === 0) { | ||
| addData(e.areas[i], option[axisKey][0], setKey); | ||
| e.areas[i][axisIndexKey] = 0; | ||
| } else { | ||
| for (j = 0; j < option[axisKey].length; j++) { | ||
| if (option[axisKey][j].gridIndex === gridIndex) { | ||
| addData(e.areas[i], option[axisKey][j], setKey); | ||
| e.areas[i][axisIndexKey] = j; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return e; | ||
| } | ||
|
|
||
| function addXAxisData(option, e) { | ||
| return addAxisData(option, e, "xAxis", "xAxisData", "xAxisIndex"); | ||
| } | ||
|
|
||
| function addYAxisData(option, e) { | ||
| return addAxisData(option, e, "yAxis", "yAxisData", "yAxisIndex"); | ||
| } | ||
|
|
||
| function addSeriesAndTitles(option, e) { | ||
| var i, xIx, yIx, serie, ai, area; | ||
| for (ai = 0; ai < e.areas.length; ai++) { | ||
| area = e.areas[ai]; | ||
| area.serieNames = []; | ||
| area.serieIndices = []; | ||
| for (i = 0; i < option.series.length; i++) { | ||
| serie = option.series[i]; | ||
| xIx = serie.xAxisIndex || 0; | ||
| yIx = serie.xAxisIndex || 0; | ||
| if (xIx == area.xAxisIndex && yIx == area.yAxisIndex) { | ||
| area.serieNames.push(serie.name); | ||
| area.serieIndices.push(i); | ||
| } | ||
| } | ||
| } | ||
| var titles, titleTexts = []; | ||
| if (!option.title) { | ||
| titles = []; | ||
| } else if (typeof option.title.length === "undefined") { | ||
| titles = [option.title]; | ||
| } else { | ||
| titles = option.title; | ||
| } | ||
| for (i = 0; i < titles.length; i++) { | ||
| if (titles[i].text) titleTexts.push(titles[i].text); | ||
| } | ||
| e.titleTexts = titleTexts; | ||
| return e; | ||
| } | ||
|
|
||
| function addAll(option, e) { | ||
| return addSeriesAndTitles(option, addYAxisData(option, addXAxisData(option, e))); | ||
| } | ||
|
|
||
| exports.on_ = function(chart) { | ||
| return function(eName) { | ||
| return function(callback) { | ||
| return function() { | ||
| return chart.on(eName, function(e) { | ||
| if (eName === "brush") { | ||
| addAll(this.getOption(), e); | ||
| } | ||
| callback(e)(); | ||
| }); | ||
| }); | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| exports.dispatchAction_ = function(action) { | ||
| return function(chart) { | ||
| return function() { | ||
| return chart.dispatchAction(action); | ||
| }; | ||
| }; | ||
| } | ||
Oops, something went wrong.
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.
You can’t perform that action at this time.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't
"type"be"brushType"? and same beloved for some other casesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's by design, too much
typefields in js. But they all are different: e.g. type for brush, type for series, type for events etc. So, in built options this is just"type": ["blahblah"]but thatblahblahmay be used only in brush context.