deno.land / x / billboardjs@3.6.0 / Chart / api / category.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
/** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */export default { /** * Set specified category name on category axis. * @function category * @instance * @memberof Chart * @param {number} i index of category to be changed * @param {string} category category value to be changed * @returns {string} * @example * chart.category(2, "Category 3"); */ category(i: number, category: string): string { const $$ = this.internal; const {config} = $$;
if (arguments.length > 1) { config.axis_x_categories[i] = category; $$.redraw(); }
return config.axis_x_categories[i]; },
/** * Set category names on category axis. * @function categories * @instance * @memberof Chart * @param {Array} categories This must be an array that includes category names in string. If category names are included in the date by data.x option, this is not required. * @returns {Array} * @example * chart.categories([ * "Category 1", "Category 2", ... * ]); */ categories(categories: string[]): string[] { const $$ = this.internal; const {config} = $$;
if (!arguments.length) { return config.axis_x_categories; }
config.axis_x_categories = categories; $$.redraw();
return config.axis_x_categories; }};
billboardjs

Version Info

Tagged at
2 years ago