1 |
|
2 |
|
3 |
|
4 |
|
5 | import { Axis } from "./axis";
|
6 | import { ChartTypes, d3Selection, DataItem, PrimitiveArray } from "./types";
|
7 |
|
8 | export interface ChartOptions {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | bindto?: string | HTMLElement | d3Selection | null | {
|
16 | |
17 |
|
18 |
|
19 | element?: string | HTMLElement | d3Selection;
|
20 |
|
21 | |
22 |
|
23 |
|
24 |
|
25 | classname?: string;
|
26 | };
|
27 |
|
28 | size?: {
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 | width?: number;
|
35 |
|
36 | |
37 |
|
38 |
|
39 |
|
40 | height?: number;
|
41 | };
|
42 |
|
43 | padding?: {
|
44 | |
45 |
|
46 |
|
47 | top?: number;
|
48 |
|
49 | |
50 |
|
51 |
|
52 | right?: number;
|
53 |
|
54 | |
55 |
|
56 |
|
57 |
|
58 | bottom?: number;
|
59 |
|
60 | |
61 |
|
62 |
|
63 | left?: number;
|
64 | };
|
65 |
|
66 | resize?: {
|
67 | |
68 |
|
69 |
|
70 | auto?: boolean;
|
71 | };
|
72 |
|
73 | color?: {
|
74 | |
75 |
|
76 |
|
77 | pattern?: string[];
|
78 |
|
79 | |
80 |
|
81 |
|
82 | threshold?: {
|
83 | |
84 |
|
85 |
|
86 |
|
87 | unit?: string;
|
88 |
|
89 | |
90 |
|
91 |
|
92 | values?: number[];
|
93 |
|
94 | |
95 |
|
96 |
|
97 |
|
98 | max?: number;
|
99 | };
|
100 |
|
101 | |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | tiles?: () => SVGPathElement[];
|
109 | };
|
110 |
|
111 | interaction?: {
|
112 | |
113 |
|
114 |
|
115 |
|
116 | enabled?: boolean;
|
117 |
|
118 | |
119 |
|
120 |
|
121 | brighten?: boolean;
|
122 |
|
123 | inputType?: {
|
124 | |
125 |
|
126 |
|
127 | mouse?: boolean;
|
128 |
|
129 | |
130 |
|
131 |
|
132 | touch?: boolean | {
|
133 | |
134 |
|
135 |
|
136 |
|
137 | preventDefault?: boolean | number;
|
138 | };
|
139 | }
|
140 | };
|
141 |
|
142 | transition?: {
|
143 | |
144 |
|
145 |
|
146 |
|
147 | duration?: number;
|
148 | };
|
149 |
|
150 | data?: Data;
|
151 |
|
152 | axis?: Axis;
|
153 |
|
154 | grid?: Grid;
|
155 |
|
156 | |
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 | regions?: RegionOptions[];
|
163 |
|
164 | legend?: LegendOptions;
|
165 |
|
166 | tooltip?: TooltipOptions;
|
167 |
|
168 | subchart?: SubchartOptions;
|
169 |
|
170 | zoom?: ZoomOptions;
|
171 |
|
172 | point?: PointOptions;
|
173 |
|
174 | line?: {
|
175 | |
176 |
|
177 |
|
178 |
|
179 |
|
180 | connectNull?: boolean;
|
181 |
|
182 | |
183 |
|
184 |
|
185 |
|
186 | step?: {
|
187 | type: "step" | "step-before" | "step-after";
|
188 | };
|
189 |
|
190 | |
191 |
|
192 |
|
193 | classes?: string[];
|
194 |
|
195 | |
196 |
|
197 |
|
198 | point?: boolean | string[];
|
199 | };
|
200 |
|
201 | area?: {
|
202 | |
203 |
|
204 |
|
205 | zerobased?: boolean;
|
206 | };
|
207 |
|
208 | bar?: {
|
209 | |
210 |
|
211 |
|
212 | width?: number | {
|
213 | |
214 |
|
215 |
|
216 | ratio: number;
|
217 |
|
218 | |
219 |
|
220 |
|
221 | max?: number;
|
222 | };
|
223 |
|
224 | |
225 |
|
226 |
|
227 | zerobased?: boolean;
|
228 |
|
229 | |
230 |
|
231 |
|
232 | space?: number;
|
233 |
|
234 | |
235 |
|
236 |
|
237 | padding?: number;
|
238 |
|
239 | |
240 |
|
241 |
|
242 |
|
243 | radius?: number | {
|
244 | |
245 |
|
246 |
|
247 | ratio?: number;
|
248 | };
|
249 | };
|
250 |
|
251 | bubble?: {
|
252 | |
253 |
|
254 |
|
255 | maxR?: (d: {}) => number | number;
|
256 | };
|
257 |
|
258 | radar?: {
|
259 | axis?: {
|
260 | |
261 |
|
262 |
|
263 | max?: number;
|
264 |
|
265 | line?: {
|
266 | |
267 |
|
268 |
|
269 | show?: boolean;
|
270 | };
|
271 |
|
272 | text?: {
|
273 | |
274 |
|
275 |
|
276 | show?: boolean;
|
277 | };
|
278 |
|
279 | direction?: {
|
280 | |
281 |
|
282 |
|
283 | clockwise: boolean;
|
284 | };
|
285 |
|
286 | level?: {
|
287 | |
288 |
|
289 |
|
290 | depth?: number;
|
291 |
|
292 | |
293 |
|
294 |
|
295 | show?: boolean;
|
296 |
|
297 | text?: {
|
298 | |
299 |
|
300 |
|
301 | format?: (x: string) => string;
|
302 |
|
303 | |
304 |
|
305 |
|
306 | show?: boolean;
|
307 | };
|
308 | }
|
309 |
|
310 | size?: {
|
311 | |
312 |
|
313 |
|
314 | ratio?: number;
|
315 | }
|
316 | }
|
317 | };
|
318 |
|
319 | pie?: {
|
320 | label?: {
|
321 | |
322 |
|
323 |
|
324 | show?: boolean;
|
325 |
|
326 | |
327 |
|
328 |
|
329 | threshold?: number;
|
330 |
|
331 | |
332 |
|
333 |
|
334 | format?(value: number, ratio: number, id: string): string;
|
335 |
|
336 | |
337 |
|
338 |
|
339 | ratio?: (d: DataItem, radius: number, h: number) => void | number
|
340 | };
|
341 | |
342 |
|
343 |
|
344 | expand?: boolean | {
|
345 | |
346 |
|
347 |
|
348 | duration?: number;
|
349 | };
|
350 |
|
351 | |
352 |
|
353 |
|
354 | innerRadius?: number;
|
355 |
|
356 | |
357 |
|
358 |
|
359 | padAngle?: number;
|
360 |
|
361 | |
362 |
|
363 |
|
364 | padding?: number;
|
365 | };
|
366 |
|
367 | donut?: {
|
368 | label?: {
|
369 | |
370 |
|
371 |
|
372 | show?: boolean;
|
373 |
|
374 | |
375 |
|
376 |
|
377 | threshold?: number;
|
378 |
|
379 | |
380 |
|
381 |
|
382 | format?(value: number, ratio: number, id: string): string;
|
383 | };
|
384 |
|
385 | |
386 |
|
387 |
|
388 | expand?: boolean;
|
389 |
|
390 | |
391 |
|
392 |
|
393 | width?: number;
|
394 |
|
395 | |
396 |
|
397 |
|
398 | title?: string;
|
399 | };
|
400 |
|
401 | gauge?: {
|
402 | label?: {
|
403 | |
404 |
|
405 |
|
406 | show?: boolean;
|
407 |
|
408 | |
409 |
|
410 |
|
411 | format?(value: any, ratio: number): string;
|
412 | };
|
413 |
|
414 | |
415 |
|
416 |
|
417 | expand?: boolean;
|
418 |
|
419 | |
420 |
|
421 |
|
422 | min?: number;
|
423 |
|
424 | |
425 |
|
426 |
|
427 | max?: number;
|
428 |
|
429 | |
430 |
|
431 |
|
432 | units?: string;
|
433 |
|
434 | |
435 |
|
436 |
|
437 | width?: number;
|
438 |
|
439 | |
440 |
|
441 |
|
442 |
|
443 |
|
444 | fullCircle?: boolean;
|
445 | };
|
446 |
|
447 | spline?: {
|
448 | interpolation?: {
|
449 | |
450 |
|
451 |
|
452 | type?: "basis"
|
453 | | "basis-open"
|
454 | | "bundle"
|
455 | | "cardinal"
|
456 | | "cardinal-closed"
|
457 | | "cardinal-open"
|
458 | | "catmull-rom"
|
459 | | "catmull-rom-closed"
|
460 | | "catmull-rom-open"
|
461 | | "monotone-x"
|
462 | | "monotone-y"
|
463 | | "natural"
|
464 | | "linear-closed"
|
465 | | "linear"
|
466 | | "step"
|
467 | | "step-after"
|
468 | | "step-before"
|
469 | };
|
470 | };
|
471 |
|
472 | |
473 |
|
474 |
|
475 | oninit?(): void;
|
476 |
|
477 | |
478 |
|
479 |
|
480 | onafterinit?(): void;
|
481 |
|
482 | |
483 |
|
484 |
|
485 | onbeforeinit?(): void;
|
486 |
|
487 | |
488 |
|
489 |
|
490 | onrendered?(): void;
|
491 |
|
492 | |
493 |
|
494 |
|
495 | onover?(): void;
|
496 |
|
497 | |
498 |
|
499 |
|
500 | onout?(): void;
|
501 |
|
502 | |
503 |
|
504 |
|
505 | onresize?(): void;
|
506 |
|
507 | |
508 |
|
509 |
|
510 | onresized?(): void;
|
511 |
|
512 | |
513 |
|
514 |
|
515 |
|
516 |
|
517 | clipPath?: boolean;
|
518 | }
|
519 |
|
520 | export interface RegionOptions {
|
521 | axis?: string;
|
522 | start?: string | number | Date;
|
523 | end?: string | number | Date;
|
524 | class?: string;
|
525 | }
|
526 |
|
527 | export interface LegendOptions {
|
528 | |
529 |
|
530 |
|
531 | show?: boolean;
|
532 |
|
533 | |
534 |
|
535 |
|
536 |
|
537 | hide?: boolean | string[] | string;
|
538 |
|
539 | |
540 |
|
541 |
|
542 |
|
543 | position?: string;
|
544 |
|
545 | |
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 | inset?: {
|
553 | anchor?: string;
|
554 | x?: number;
|
555 | y?: number;
|
556 | step?: number;
|
557 | };
|
558 | |
559 |
|
560 |
|
561 | padding?: number;
|
562 |
|
563 | item?: {
|
564 | |
565 |
|
566 |
|
567 | tile?: {
|
568 | |
569 |
|
570 |
|
571 | width?: number;
|
572 |
|
573 | |
574 |
|
575 |
|
576 | height?: number;
|
577 | };
|
578 | |
579 |
|
580 |
|
581 | onclick?(id: DataItem): void;
|
582 |
|
583 | |
584 |
|
585 |
|
586 | onover?(id: DataItem): void;
|
587 |
|
588 | |
589 |
|
590 |
|
591 | onout?(id: DataItem): void;
|
592 | };
|
593 |
|
594 | |
595 |
|
596 |
|
597 | contents?: {
|
598 | |
599 |
|
600 |
|
601 | bindto?: string | HTMLElement;
|
602 |
|
603 | |
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 | template?: (title: string, color: string, data: DataItem[]) => void | string;
|
614 | };
|
615 |
|
616 | |
617 |
|
618 |
|
619 | usePoint?: boolean;
|
620 | }
|
621 |
|
622 | export interface TooltipOptions {
|
623 | |
624 |
|
625 |
|
626 | show?: boolean;
|
627 |
|
628 | |
629 |
|
630 |
|
631 | grouped?: boolean;
|
632 | format?: {
|
633 | |
634 |
|
635 |
|
636 | title?(x: any): string;
|
637 |
|
638 | |
639 |
|
640 |
|
641 |
|
642 |
|
643 | name?(name: string, ratio: number, id: string, index: number): string;
|
644 |
|
645 | |
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | value?(value: any, ratio: number, id: string, index: number): string;
|
652 | };
|
653 | |
654 |
|
655 |
|
656 |
|
657 | order?: string | any[] | ((data1: any, data2: any) => number) | null;
|
658 |
|
659 | /**
|
660 | * Set custom position for the tooltip.
|
661 | * This option can be used to modify the tooltip position by returning object that has top and left.
|
662 | */
|
663 | position?(
|
664 | data: any,
|
665 | width: number,
|
666 | height: number,
|
667 | element: any
|
668 | ): { top: number; left: number };
|
669 |
|
670 | /**
|
671 | * Set custom HTML for the tooltip.
|
672 | * Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show.
|
673 | * If tooltip.grouped is true, data includes multiple data points.
|
674 | */
|
675 | contents?(
|
676 | data: any,
|
677 | defaultTitleFormat: string,
|
678 | defaultValueFormat: string,
|
679 | color: any
|
680 | ): string;
|
681 |
|
682 | init?: {
|
683 | /**
|
684 | * Show tooltip at the initialization.
|
685 | */
|
686 | show?: boolean;
|
687 |
|
688 | /**
|
689 | * Set x Axis index to be shown at the initialization.
|
690 | */
|
691 | x?: number;
|
692 |
|
693 | /**
|
694 | * Set the position of tooltip at the initialization.
|
695 | */
|
696 | position?: {
|
697 | top?: string;
|
698 | left?: string;
|
699 | }
|
700 | };
|
701 |
|
702 | /**
|
703 | * Set a callback that will be invoked before the tooltip is shown.
|
704 | */
|
705 | onshow?(): void;
|
706 |
|
707 | /**
|
708 | * Set a callback that will be invoked before the tooltip is hidden.
|
709 | */
|
710 | onhide?(): void;
|
711 |
|
712 | /**
|
713 | * Set a callback that will be invoked after the tooltip is shown
|
714 | */
|
715 | onshown?(): void;
|
716 |
|
717 | /**
|
718 | * Set a callback that will be invoked after the tooltip is hidden.
|
719 | */
|
720 | onhidden?(): void;
|
721 |
|
722 | /**
|
723 | * Set if tooltips on all visible charts with like x points are shown together when one is shown.
|
724 | */
|
725 | linked?: boolean | {
|
726 | /**
|
727 | * Groping name for linked tooltip.
|
728 | * If specified, linked tooltip will be groped interacting to be worked only with the same name.
|
729 | */
|
730 | name?: string;
|
731 | };
|
732 | }
|
733 |
|
734 | export interface SubchartOptions {
|
735 | /**
|
736 | * Show sub chart on the bottom of the chart.
|
737 | */
|
738 | show?: boolean;
|
739 | size?: {
|
740 | /**
|
741 | * Change the height of the subchart.
|
742 | */
|
743 | height: number;
|
744 | };
|
745 |
|
746 | /**
|
747 | * Set callback for brush event.
|
748 | * Specified function receives the current zoomed x domain.
|
749 | */
|
750 | onbrush?(domain: any): void;
|
751 | }
|
752 |
|
753 | export interface ZoomOptions {
|
754 | /**
|
755 | * Enable zooming.
|
756 | */
|
757 | enabled?: boolean | {
|
758 | /**
|
759 | * Set zoom interaction type.
|
760 | */
|
761 | type?: "scroll" | "drag";
|
762 | };
|
763 |
|
764 | /**
|
765 | * Enable to rescale after zooming.
|
766 | * If true set, y domain will be updated according to the zoomed region.
|
767 | */
|
768 | rescale?: boolean;
|
769 |
|
770 | /**
|
771 | * Change zoom extent.
|
772 | */
|
773 | extent?: [number, number];
|
774 |
|
775 | x?: {
|
776 | /**
|
777 | * Set x Axis minimum zoom range
|
778 | */
|
779 | min?: number;
|
780 |
|
781 | /**
|
782 | * Set x Axis maximum zoom range
|
783 | */
|
784 | max?: number;
|
785 | };
|
786 |
|
787 | /**
|
788 | * Set callback that is called when zooming starts.
|
789 | * Specified function receives the zoom event.
|
790 | */
|
791 | onzoomstart?(event: Event): void;
|
792 |
|
793 | /**
|
794 | * Set callback that is called when the chart is zooming.
|
795 | * Specified function receives the zoomed domain.
|
796 | */
|
797 | onzoom?(domain: any): void;
|
798 |
|
799 | /**
|
800 | * Set callback that is called when zooming ends.
|
801 | * Specified function receives the zoomed domain.
|
802 | */
|
803 | onzoomend?(domain: any): void;
|
804 |
|
805 | /**
|
806 | * Set to display zoom reset button for 'drag' type zoom
|
807 | */
|
808 | resetButton?: boolean | {
|
809 | /**
|
810 | * Text value for zoom reset button.
|
811 | */
|
812 | text?: string;
|
813 | };
|
814 | }
|
815 |
|
816 | export interface PointOptions {
|
817 | /**
|
818 | * Whether to show each point in line.
|
819 | */
|
820 | show?: boolean;
|
821 |
|
822 | /**
|
823 | * The radius size of each point.
|
824 | */
|
825 | r?: number | ((d: DataItem) => number);
|
826 |
|
827 | focus?: {
|
828 | expand: {
|
829 | /**
|
830 | * Whether to expand each point on focus.
|
831 | */
|
832 | enabled?: boolean;
|
833 |
|
834 | /**
|
835 | * The radius size of each point on focus.
|
836 | */
|
837 | r?: number;
|
838 | };
|
839 | };
|
840 |
|
841 | select?: {
|
842 | /**
|
843 | * The radius size of each point on selected.
|
844 | */
|
845 | r?: number;
|
846 | };
|
847 |
|
848 | /**
|
849 | * The type of point to be drawn
|
850 | * - NOTE: If chart has 'bubble' type, only circle can be used.
|
851 | * For IE, non circle point expansions are not supported due to lack of transform support.
|
852 | *
|
853 | * - Available Values:
|
854 | * - circle
|
855 | * - rectangle
|
856 | */
|
857 | type?: string;
|
858 |
|
859 | /**
|
860 | * The type of point or svg shape as string, to be drawn for each line
|
861 | * - NOTE:
|
862 | * This is an experimental feature and can have some unexpected behaviors.
|
863 | * If chart has 'bubble' type, only circle can be used.
|
864 | * For IE, non circle point expansions are not supported due to lack of transform support.
|
865 | *
|
866 | * - Available Values:
|
867 | * - circle
|
868 | * - rectangle
|
869 | * - svg shape tag interpreted as string (ex. <polygon points='2.5 0 0 5 5 5'></polygon>)
|
870 | */
|
871 | pattern?: string[];
|
872 | }
|
873 |
|
874 | export interface Grid {
|
875 | /**
|
876 | * Set 'grid & focus lines' to be positioned over grid lines and chart elements.
|
877 | */
|
878 | front?: boolean;
|
879 |
|
880 | focus?: {
|
881 | /**
|
882 | * Show grids when focus.
|
883 | */
|
884 | show?: boolean;
|
885 | };
|
886 |
|
887 | lines?: {
|
888 | /**
|
889 | * Set grid lines to be positioned over chart elements.
|
890 | */
|
891 | front?: boolean;
|
892 | };
|
893 |
|
894 | x?: {
|
895 | /**
|
896 | * Show grids along x axis.
|
897 | */
|
898 | show?: boolean;
|
899 |
|
900 | /**
|
901 | * Show additional grid lines along x axis.
|
902 | * This option accepts array including object that has value, text, position and class.
|
903 | * text, position and class are optional. For position, start, middle and end (default) are available.
|
904 | * If x axis is category axis, value can be category name.
|
905 | * If x axis is timeseries axis, value can be date string, Date object and unixtime integer.
|
906 | */
|
907 | lines?: LineOptions[];
|
908 | };
|
909 |
|
910 | y?: {
|
911 | /**
|
912 | * Show grids along y axis.
|
913 | */
|
914 | show?: boolean;
|
915 |
|
916 | /**
|
917 | * Show additional grid lines along y axis.
|
918 | * This option accepts array including object that has value, text, position and class.
|
919 | */
|
920 | lines?: LineOptions[];
|
921 |
|
922 | /**
|
923 | * Number of y grids to be shown.
|
924 | */
|
925 | ticks?: number;
|
926 | };
|
927 | }
|
928 |
|
929 | export interface LineOptions {
|
930 | value: string | number | Date;
|
931 | text?: string;
|
932 | axis?: string;
|
933 | position?: string;
|
934 | class?: string;
|
935 | }
|
936 |
|
937 | export interface Data {
|
938 | /**
|
939 | * Load a CSV or JSON file from a URL.
|
940 | * Note that this will not work if loading via the "file://" protocol as most browsers with block XMLHTTPRequests.
|
941 | */
|
942 | url?: string;
|
943 |
|
944 | /**
|
945 | * Load data from a multidimensional array, with the first element containing the data names, the following containing related data in that order.
|
946 | */
|
947 | rows?: PrimitiveArray[];
|
948 |
|
949 | /*
|
950 | * Load data from a multidimensional array, with each element containing an array consisting of a datum name and associated data values.
|
951 | */
|
952 | columns?: PrimitiveArray[];
|
953 |
|
954 | /**
|
955 | * XHR header value
|
956 | * - NOTE: Should be used with data.url option
|
957 | */
|
958 | headers?: Array<{ [key: string]: string; }>;
|
959 |
|
960 | /**
|
961 | * Hide each data when the chart appears.
|
962 | * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
|
963 | */
|
964 | hide?: boolean | string[];
|
965 |
|
966 | /**
|
967 | * Converts data id value
|
968 | */
|
969 | idConverter?: (id: string) => string;
|
970 |
|
971 | |
972 |
|
973 |
|
974 | json?: {};
|
975 |
|
976 | |
977 |
|
978 |
|
979 | mimeType?: string;
|
980 |
|
981 | |
982 |
|
983 |
|
984 | keys?: { x?: string; value: string[] };
|
985 |
|
986 | |
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 | x?: string;
|
993 |
|
994 | |
995 |
|
996 |
|
997 |
|
998 | xs?: { [key: string]: string };
|
999 |
|
1000 | |
1001 |
|
1002 |
|
1003 |
|
1004 | xFormat?: string;
|
1005 | |
1006 |
|
1007 |
|
1008 | xLocaltime?: boolean;
|
1009 |
|
1010 | |
1011 |
|
1012 |
|
1013 | xSort?: boolean;
|
1014 |
|
1015 | |
1016 |
|
1017 |
|
1018 | names?: { [key: string]: string };
|
1019 | |
1020 |
|
1021 |
|
1022 |
|
1023 | classes?: { [key: string]: string };
|
1024 |
|
1025 | |
1026 |
|
1027 |
|
1028 | groups?: string[][];
|
1029 |
|
1030 | |
1031 |
|
1032 |
|
1033 | axes?: { [key: string]: string };
|
1034 |
|
1035 | |
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 | type?: ChartTypes;
|
1041 |
|
1042 | |
1043 |
|
1044 |
|
1045 |
|
1046 | types?: { [key: string]: ChartTypes };
|
1047 |
|
1048 | |
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 | labels?: boolean
|
1058 | | { format: FormatFunction }
|
1059 | | { format: { [key: string]: FormatFunction } }
|
1060 | | {
|
1061 | position: {
|
1062 | x?: number;
|
1063 | y?: number;
|
1064 | }
|
1065 | };
|
1066 |
|
1067 | |
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | order?: string | ((...data: string[]) => void) | null;
|
1074 |
|
1075 | /**
|
1076 | * Define regions for each data.
|
1077 | * The values must be an array for each data and it should include an object that has start, end, style.
|
1078 | * If start is not set, the start will be the first data point. If end is not set, the end will be the last data point.
|
1079 | * Currently this option supports only line chart and dashed style. If this option specified, the line will be dashed only in the regions.
|
1080 | */
|
1081 | regions?: { [key: string]: Array<{
|
1082 | start?: number;
|
1083 | end?: number;
|
1084 | style?: {
|
1085 | dasharray?: string;
|
1086 | };
|
1087 | }> };
|
1088 |
|
1089 | /**
|
1090 | * Set color converter function.
|
1091 | * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc.
|
1092 | * And it must return a string that represents color (e.g. '#00ff00').
|
1093 | */
|
1094 | color?(color: string, d: DataItem): string;
|
1095 |
|
1096 | /**
|
1097 | * Set color for each data.
|
1098 | */
|
1099 | colors?: {
|
1100 | [key: string]: string | ((d: DataItem) => string);
|
1101 | };
|
1102 |
|
1103 | /**
|
1104 | * Set text displayed when empty data.
|
1105 | */
|
1106 | empty?: { label: { text: string } };
|
1107 |
|
1108 | selection?: {
|
1109 | /**
|
1110 | * Set data selection enabled
|
1111 | * If this option is set true, we can select the data points and get/set its state of selection by API (e.g. select, unselect, selected).
|
1112 | */
|
1113 | enabled?: boolean;
|
1114 |
|
1115 | /**
|
1116 | * Set grouped selection enabled.
|
1117 | * If this option set true, multiple data points that have same x value will be selected by one selection.
|
1118 | */
|
1119 | grouped?: boolean;
|
1120 |
|
1121 | /**
|
1122 | * Set multiple data points selection enabled.
|
1123 | * If this option set true, multile data points can have the selected state at the same time.
|
1124 | * If false set, only one data point can have the selected state and the others will be unselected when the new data point is selected.
|
1125 | */
|
1126 | multiple?: boolean;
|
1127 |
|
1128 | /**
|
1129 | * Enable to select data points by dragging. If this option set true, data points can be selected by dragging.
|
1130 | * NOTE: If this option set true, scrolling on the chart will be disabled because dragging event will handle the event.
|
1131 | */
|
1132 | draggable?: boolean;
|
1133 |
|
1134 | /**
|
1135 | * Set a callback for each data point to determine if it's selectable or not.
|
1136 | * The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
|
1137 | * @param d Data object
|
1138 | */
|
1139 | isselectable?(d?: any): boolean;
|
1140 | };
|
1141 |
|
1142 | filter?: (v: Array<{
|
1143 | id: string;
|
1144 | id_org: string;
|
1145 | values: Array<{
|
1146 | x: number;
|
1147 | value: number;
|
1148 | id: string;
|
1149 | index: number;
|
1150 | }>
|
1151 | }>) => boolean;
|
1152 |
|
1153 | stack?: {
|
1154 | |
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 | normalize?: boolean;
|
1161 | };
|
1162 |
|
1163 | |
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | onclick?(d: DataItem, element: any): void;
|
1169 |
|
1170 | |
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | onover?(d: DataItem, element?: any): void;
|
1176 |
|
1177 | |
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 | onout?(d: DataItem, element?: any): void;
|
1183 |
|
1184 | |
1185 |
|
1186 |
|
1187 | onselected?(d: DataItem, element?: any): void;
|
1188 |
|
1189 | |
1190 |
|
1191 |
|
1192 | onunselected?(d: DataItem, element?: any): void;
|
1193 |
|
1194 | |
1195 |
|
1196 |
|
1197 |
|
1198 | onmin?(d: DataItem[]): void;
|
1199 |
|
1200 | |
1201 |
|
1202 |
|
1203 |
|
1204 | onmax?(d: DataItem[]): void;
|
1205 | }
|
1206 |
|
1207 | export type FormatFunction = (
|
1208 | v: any,
|
1209 | id: string,
|
1210 | i: number,
|
1211 | j: number
|
1212 | ) => void;
|