deno.land / x / billboardjs@3.6.0 / core.ts

نووسراو ببینە
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
/** * Copyright (c) 2017 ~ present NAVER Corp. * billboard project is licensed under the MIT license */import Chart from "./Chart/Chart";import {isObject, mergeObj} from "./module/util";
// eslint-disable-next-line no-use-before-defineexport {bb, bb as default};
let defaults = {};
/** * @namespace bb * @version __VERSION__ */const bb = { /** * Version information * @property {string} version version * @example * bb.version; // "1.0.0" * @memberof bb */ version: "__VERSION__",
/** * Generate chart * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: * - Unused option value is given. * - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error. * - Insufficient value is given for certain option used. * - ex) `data: { x: "x", columns: [["x"], ["data1", 30, 200, 100]] }` * @param {Options} config chart options * @memberof bb * @returns {Chart} * @see {@link Options} for different generation options * @see {@link Chart} for different methods API * @example * <!-- chart holder --> * <div id="LineChart"></div> * @example * // Generate chart with options * var chart = bb.generate({ * "bindto": "#LineChart" * "data": { * "columns": [ * ["data1", 30, 200, 100, 400, 150, 250], * ["data2", 50, 20, 10, 40, 15, 25] * ], * "type": "line" * } * }); * * // call some API * // ex) get the data of 'data1' * chart.data("data1"); * @example * // Generate chart by importing ESM * // Import types to be used only, where this will make smaller bundle size. * import bb, { * area, * areaLineRange, * areaSpline, * areaSplineRange, * areaStep, * bar, * bubble, * donut, * gauge, * line, * pie, * polar, * radar, * scatter, * spline, * step * } * * bb.generate({ * "bindto": "#LineChart" * "data": { * "columns": [ * ["data1", 30, 200, 100, 400, 150, 250], * ["data2", 50, 20, 10, 40, 15, 25] * ] * }, * type: line(), * * // or * types: { * data1: bar(), * data2: step() * } * }); */ generate(config) { const options = mergeObj({}, defaults, config); const inst = new Chart(options);
inst.internal.charts = this.instance; this.instance.push(inst);
return inst; },
/** * Set or get global default options. * - **NOTE:** * - The options values settings are valid within page context only. * - If is called multiple times, will override the last value. * @param {Options} options chart options * @memberof bb * @returns {Options} * @see {@link Options} * @example * // Set same option value as for `.generate()` * bb.defaults({ * data: { * type: "bar" * } * }); * * bb.defaults(); // {data:{type: "bar"}} * * // data.type defaults to 'bar' * var chart = bb.generate({ ... }); */ defaults(options?) { if (isObject(options)) { defaults = options; }
return defaults; },
/** * An array containing instance created * @property {Array} instance instance array * @example * // generate charts * var chart1 = bb.generate(...); * var chart2 = bb.generate(...); * * bb.instance; // [ chart1, chart2, ... ] * @memberof bb */ instance: [],
/** * Namespace for plugins * @property {object} plugin plugin namespace * @example * // Stanford diagram plugin * bb.plugin.stanford; * @memberof bb */ plugin: {}};
billboardjs

Version Info

Tagged at
a year ago