()
| 251 | } |
| 252 | |
| 253 | update_data() { |
| 254 | this.dirty = true; |
| 255 | // Handling data updates |
| 256 | const that = this; |
| 257 | this.x_data = this.get('x'); |
| 258 | this.y_data = this.get('y'); |
| 259 | |
| 260 | let curve_labels = this.get('labels'); |
| 261 | if (this.x_data.length === 0 || this.y_data.length === 0) { |
| 262 | this.mark_data = []; |
| 263 | this.data_len = 0; |
| 264 | } else { |
| 265 | this.x_data = !_.isNumber(this.x_data[0]) ? this.x_data : [this.x_data]; |
| 266 | this.y_data = !_.isNumber(this.y_data[0]) ? this.y_data : [this.y_data]; |
| 267 | curve_labels = this.get_labels(); |
| 268 | const color_data = this.get('color') || []; |
| 269 | const width_data = [this.get('width') || []]; |
| 270 | this.data_len = Math.min(this.x_data[0].length, this.y_data[0].length); |
| 271 | |
| 272 | this.mark_data = [ |
| 273 | { |
| 274 | name: curve_labels[0], |
| 275 | values: _.range(this.data_len - 1).map((val, index) => { |
| 276 | return { |
| 277 | x1: that.x_data[0][index], |
| 278 | y1: that.y_data[0][index], |
| 279 | x2: that.x_data[0][index + 1], |
| 280 | y2: that.y_data[0][index + 1], |
| 281 | color: color_data[index], |
| 282 | size: width_data[0][index], |
| 283 | }; |
| 284 | }), |
| 285 | }, |
| 286 | ]; |
| 287 | } |
| 288 | |
| 289 | this.update_domains(); |
| 290 | this.dirty = false; |
| 291 | this.trigger('data_updated'); |
| 292 | } |
| 293 | |
| 294 | update_domains() { |
| 295 | if (!this.mark_data) { |
nothing calls this directly
no test coverage detected