diff --git a/src/config/Options/data/axis.ts b/src/config/Options/data/axis.ts index b6179f08e..343bd3bea 100644 --- a/src/config/Options/data/axis.ts +++ b/src/config/Options/data/axis.ts @@ -6,20 +6,6 @@ * Axis based chart data config options */ export default { - /** - * Specify the key of x values in the data.

- * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names. - * @name data․x - * @memberof Options - * @type {string} - * @default undefined - * @example - * data: { - * x: "date" - * } - */ - data_x: undefined, - /** * Specify the keys of the x values for each data.

* This option can be used if we want to show the data that has different x values. diff --git a/src/config/Options/data/data.ts b/src/config/Options/data/data.ts index 02286fc7f..0c032f455 100644 --- a/src/config/Options/data/data.ts +++ b/src/config/Options/data/data.ts @@ -8,6 +8,20 @@ import {ChartTypes} from "../../../../types/types"; * data config options */ export default { + /** + * Specify the key of x values in the data.

+ * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names. + * @name data․x + * @memberof Options + * @type {string} + * @default undefined + * @example + * data: { + * x: "date" + * } + */ + data_x: undefined, + /** * Converts data id value * @name data․idConverter diff --git a/test/esm/radar-spec.ts b/test/esm/radar-spec.ts new file mode 100644 index 000000000..c65713e00 --- /dev/null +++ b/test/esm/radar-spec.ts @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2017 ~ present NAVER Corp. + * billboard.js project is licensed under the MIT license + */ +/* eslint-disable */ +/* global describe, beforeEach, it, expect */ +import {expect} from "chai"; +import bb, {radar} from "../../src/index.esm"; +import CLASS from "../../src/config/classes"; + +describe("ESM radar", function() { + let chart; + + const args: any = { + data: { + x: "x", + columns: [ + ["x", "Data A", "Data B", "Data C", "Data D", "Data E"], + ["data1", 330, 350, 200, 380, 150], + ["data2", 130, 100, 30, 200, 80], + ["data3", 230, 153, 85, 300, 250] + ], + type: radar(), + labels: true + }, + radar: { + axis: { + max: 400 + }, + level: { + depth: 4 + }, + direction: { + clockwise: true + } + } + }; + + beforeEach(() => { + chart = bb.generate(args); + }); + + it("should correctly render radar chart", () => { + const categories = chart.internal.config.axis_x_categories; + + expect(categories.length === args.data.columns[0].length - 1).to.be.true; + + chart.$.main.selectAll(`.${CLASS.axis} text`).each(function(d, i) { + expect(this.textContent).to.be.equal(categories[i]); + }); + }); +}); \ No newline at end of file