(chart)
| 29113 | var DOM_ATTRIBUTE_KEY = '_echarts_instance_'; |
| 29114 | |
| 29115 | function enableConnect(chart) { |
| 29116 | var STATUS_PENDING = 0; |
| 29117 | var STATUS_UPDATING = 1; |
| 29118 | var STATUS_UPDATED = 2; |
| 29119 | var STATUS_KEY = '__connectUpdateStatus'; |
| 29120 | |
| 29121 | function updateConnectedChartsStatus(charts, status) { |
| 29122 | for (var i = 0; i < charts.length; i++) { |
| 29123 | var otherChart = charts[i]; |
| 29124 | otherChart[STATUS_KEY] = status; |
| 29125 | } |
| 29126 | } |
| 29127 | |
| 29128 | each(eventActionMap, function (actionType, eventType) { |
| 29129 | chart._messageCenter.on(eventType, function (event) { |
| 29130 | if (connectedGroups[chart.group] && chart[STATUS_KEY] !== STATUS_PENDING) { |
| 29131 | if (event && event.escapeConnect) { |
| 29132 | return; |
| 29133 | } |
| 29134 | |
| 29135 | var action = chart.makeActionFromEvent(event); |
| 29136 | var otherCharts = []; |
| 29137 | |
| 29138 | each(instances, function (otherChart) { |
| 29139 | if (otherChart !== chart && otherChart.group === chart.group) { |
| 29140 | otherCharts.push(otherChart); |
| 29141 | } |
| 29142 | }); |
| 29143 | |
| 29144 | updateConnectedChartsStatus(otherCharts, STATUS_PENDING); |
| 29145 | each(otherCharts, function (otherChart) { |
| 29146 | if (otherChart[STATUS_KEY] !== STATUS_UPDATING) { |
| 29147 | otherChart.dispatchAction(action); |
| 29148 | } |
| 29149 | }); |
| 29150 | updateConnectedChartsStatus(otherCharts, STATUS_UPDATED); |
| 29151 | } |
| 29152 | }); |
| 29153 | }); |
| 29154 | } |
| 29155 | |
| 29156 | /** |
| 29157 | * @param {HTMLElement} dom |
no test coverage detected