Repository navigation
Expand file tree
/
Copy pathBarChart.js
More file actions
164 lines (154 loc) · 3.98 KB
/
Copy pathBarChart.js
File metadata and controls
164 lines (154 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*********************************************************************************
Copyright © SuperMap. All rights reserved.
Author: Wang zihao
E-mail: pridehao@gmail.com
**********************************************************************************/
import {NativeModules} from 'react-native';
import ChartView from './ChartView.js';
let BC = NativeModules.JSBarChart;
/**
* @class BarChart
* @description 柱状图类
*/
export default class BarChart extends ChartView{
constructor(){
super();
Object.defineProperty(this,"barchartId",{
get:function(){
return this.chartviewId
},
set:function (barchartId){
this.chartviewId = barchartId;
}
})
}
/**
* 设置数值是否按照X轴分布
* @memberOf BarChart
* @param {boolean} b
* @returns {Promise.<void>}
*/
async setValueAlongXAxis(b){
try{
await BC.setValueAlongXAxis(this.barchartId,b);
}catch(e){
console.error(e);
}
}
/**
* 判断数值是否按照X轴分布
* @memberOf BarChart
* @returns {Promise.<boolean>}
*/
async isValueAlongXAxis(){
try{
var{isAlong} = await BC.isValueAlongXAxis(this.barchartId);
return isAlong;
}catch(e){
console.error(e);
}
}
/**
* 设置X坐标轴显示标签
* @memberOf BarChart
* @param {object} xAxisLables - 数据数组
* @returns {Promise.<void>}
*/
async setXAxisLables(xAxisLables){
try{
await BC.setXAxisLables(this.barchartId,xAxisLables);
}catch(e){
console.error(e);
}
}
/**
* 获取X坐标轴显示标签
* @memberOf ChartView
* @returns {Promise.<Arr>}
*/
async getXAxisLables(){
try{
var {xAxisLables} = await BC.getXAxisLables(this.barchartId);
return xAxisLables;
}catch(e){
console.error(e);
}
}
/**
* 设置X坐标轴标题。
* @memberOf ChartView
* @param {string} title - 标题
* @returns {Promise.<void>}
*/
async setXAxisTitle(title){
try{
await BC.setXAxisTitle(this.barchartId,title);
}catch(e){
console.error(e);
}
}
/**
* 获取X坐标轴标题。
* @memberOf ChartView
* @returns {Promise.<string>}
*/
async getXAxisTitle(){
try{
var {title} = await BC.getXAxisTitle(this.barchartId);
return title;
}catch(e){
console.error(e);
}
}
/**
* 设置Y坐标轴标题。
* @memberOf ChartView
* @param {string} title - 标题
* @returns {Promise.<void>}
*/
async setYAxisTitle(title){
try{
await BC.setYAxisTitle(this.barchartId,title);
}catch(e){
console.error(e);
}
}
/**
* 获取Y坐标轴标题。
* @memberOf ChartView
* @returns {Promise.<string>}
*/
async getYAxisTitle(){
try{
var {title} = await BC.getYAxisTitle(this.barchartId);
return title;
}catch(e){
console.error(e);
}
}
/**
* 设置图表选中回调
* @memberOf ChartView
* @returns {Promise.<void>}
*/
async setChartOnSelected(){
try{
await BC.setChartOnSelected(this.barchartId);
}catch(e){
console.error(e);
}
}
/**
* 设置选中的对象ID
* @memberOf ChartView
* @param {number} geoId
* @returns {Promise.<void>}
*/
async setSelectedGeometryID(geoId){
try{
await BC.setSelectedGeometryID(this.chartviewId,geoId);
}catch(e){
console.error(e);
}
}
}