File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export default class App extends Component {
21
21
height : this . props . height || 400 ,
22
22
} }
23
23
source = { require ( './tpl.html' ) }
24
+ onMessage = { event => this . props . onPress ? this . props . onPress ( JSON . parse ( event . nativeEvent . data ) ) : null }
24
25
/>
25
26
</ View >
26
27
) ;
Original file line number Diff line number Diff line change @@ -9,5 +9,18 @@ export default function renderChart(props) {
9
9
document.getElementById('main').style.width = "${ width } ";
10
10
var myChart = echarts.init(document.getElementById('main'));
11
11
myChart.setOption(${ toString ( props . option ) } );
12
+ myChart.on('click', function(params) {
13
+ var seen = [];
14
+ var paramsString = JSON.stringify(params, function(key, val) {
15
+ if (val != null && typeof val == "object") {
16
+ if (seen.indexOf(val) >= 0) {
17
+ return;
18
+ }
19
+ seen.push(val);
20
+ }
21
+ return val;
22
+ });
23
+ window.postMessage(paramsString);
24
+ });
12
25
`
13
26
}
You can’t perform that action at this time.
0 commit comments