| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { Node } from '../node';
- export class MarkNode extends Node {
- changeData(data) {
- const chart = this.getRoot();
- if (!chart)
- return;
- this.attr('data', data);
- return chart === null || chart === void 0 ? void 0 : chart.render();
- }
- /**
- * Get mark from chart views.
- */
- getMark() {
- var _a;
- const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
- if (!chartView)
- return undefined;
- const { markState } = chartView;
- const markKey = Array.from(markState.keys()).find((item) => item.key === this.attr('key'));
- return markState.get(markKey);
- }
- /**
- * Get all scales instance.
- */
- getScale() {
- var _a;
- const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
- if (!chartView)
- return undefined;
- return chartView === null || chartView === void 0 ? void 0 : chartView.scale;
- }
- /**
- * Get the scale instance by channel.
- */
- getScaleByChannel(channel) {
- var _a, _b;
- const chartView = (_a = this.getRoot()) === null || _a === void 0 ? void 0 : _a.getView();
- if (!chartView)
- return undefined;
- return (_b = chartView === null || chartView === void 0 ? void 0 : chartView.scale) === null || _b === void 0 ? void 0 : _b[channel];
- }
- /**
- * Get canvas group.
- */
- getGroup() {
- const key = this.attr('key');
- if (!key)
- return undefined;
- const chart = this.getRoot();
- const chartGroup = chart.getContext().canvas.getRoot();
- return chartGroup.getElementById(key);
- }
- }
- //# sourceMappingURL=base.js.map
|