@funnest/charts-cli 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4 -2
- package/dist/index.js +4 -2
- package/dist/spec.d.ts +2 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -268,7 +268,7 @@ function element(spec, width, height) {
|
|
|
268
268
|
case "area":
|
|
269
269
|
return /* @__PURE__ */ jsx(AreaChart, { ...common, stacked: spec.stacked ?? false, ...spec.curve ? { curve: spec.curve } : {}, children: extras });
|
|
270
270
|
case "bar":
|
|
271
|
-
return /* @__PURE__ */ jsx(BarChart, { ...common, stacked: spec.stacked ?? false, ...spec.colorBySign ? { getBarColor: (v) => v >= 0 ? UP : DOWN } : {}, children: extras });
|
|
271
|
+
return /* @__PURE__ */ jsx(BarChart, { ...common, stacked: spec.stacked ?? false, ...spec.layout === "horizontal" ? { layout: "horizontal" } : {}, ...spec.colorBySign ? { getBarColor: (v) => v >= 0 ? UP : DOWN } : {}, children: extras });
|
|
272
272
|
case "sparkline": {
|
|
273
273
|
const s = series[0];
|
|
274
274
|
const vals = (s?.data ?? []).filter((v) => v !== null);
|
|
@@ -455,6 +455,7 @@ export function Chart() {
|
|
|
455
455
|
if (spec.stacked) props.push("stacked");
|
|
456
456
|
if (spec.area && spec.area !== "none") props.push(`area=${lit(spec.area)}`);
|
|
457
457
|
if (spec.curve) props.push(`curve=${lit(spec.curve)}`);
|
|
458
|
+
if (spec.type === "bar" && spec.layout === "horizontal") props.push('layout="horizontal"');
|
|
458
459
|
if (spec.type === "bar" && spec.colorBySign) props.push("getBarColor={(v) => (v >= 0 ? '#F04452' : '#3182F6')}");
|
|
459
460
|
if (ys.length > 1 || spec.legend) props.push("legend");
|
|
460
461
|
const children = [
|
|
@@ -572,7 +573,8 @@ var CHARTS = {
|
|
|
572
573
|
...COMMON,
|
|
573
574
|
...SERIES,
|
|
574
575
|
stacked: { kind: "boolean", default: false, ko: "\uC704\uB85C \uC313\uAE30", en: "Stack series" },
|
|
575
|
-
colorBySign: { kind: "boolean", default: false, ko: "0 \uC774\uC0C1 \uBE68\uAC15, \uBBF8\uB9CC \uD30C\uB791", en: "Red for \u2265 0, blue for < 0" }
|
|
576
|
+
colorBySign: { kind: "boolean", default: false, ko: "0 \uC774\uC0C1 \uBE68\uAC15, \uBBF8\uB9CC \uD30C\uB791", en: "Red for \u2265 0, blue for < 0" },
|
|
577
|
+
layout: { kind: "string", enum: ["vertical", "horizontal"], default: "vertical", ko: "'horizontal'\uC774\uBA74 \uAC00\uB85C \uB9C9\uB300 (\uC21C\uC704, \uC5C5\uC885\uBCC4 \uC218\uC775\uB960)", en: "'horizontal' for left-to-right bars (rankings, sector returns)" }
|
|
576
578
|
},
|
|
577
579
|
example: {
|
|
578
580
|
title: "\uC77C\uBCC4 \uC190\uC775",
|
package/dist/index.js
CHANGED
|
@@ -158,7 +158,8 @@ var CHARTS = {
|
|
|
158
158
|
...COMMON,
|
|
159
159
|
...SERIES,
|
|
160
160
|
stacked: { kind: "boolean", default: false, ko: "\uC704\uB85C \uC313\uAE30", en: "Stack series" },
|
|
161
|
-
colorBySign: { kind: "boolean", default: false, ko: "0 \uC774\uC0C1 \uBE68\uAC15, \uBBF8\uB9CC \uD30C\uB791", en: "Red for \u2265 0, blue for < 0" }
|
|
161
|
+
colorBySign: { kind: "boolean", default: false, ko: "0 \uC774\uC0C1 \uBE68\uAC15, \uBBF8\uB9CC \uD30C\uB791", en: "Red for \u2265 0, blue for < 0" },
|
|
162
|
+
layout: { kind: "string", enum: ["vertical", "horizontal"], default: "vertical", ko: "'horizontal'\uC774\uBA74 \uAC00\uB85C \uB9C9\uB300 (\uC21C\uC704, \uC5C5\uC885\uBCC4 \uC218\uC775\uB960)", en: "'horizontal' for left-to-right bars (rankings, sector returns)" }
|
|
162
163
|
},
|
|
163
164
|
example: {
|
|
164
165
|
title: "\uC77C\uBCC4 \uC190\uC775",
|
|
@@ -441,7 +442,7 @@ function element(spec, width, height) {
|
|
|
441
442
|
case "area":
|
|
442
443
|
return /* @__PURE__ */ jsx(AreaChart, { ...common, stacked: spec.stacked ?? false, ...spec.curve ? { curve: spec.curve } : {}, children: extras });
|
|
443
444
|
case "bar":
|
|
444
|
-
return /* @__PURE__ */ jsx(BarChart, { ...common, stacked: spec.stacked ?? false, ...spec.colorBySign ? { getBarColor: (v) => v >= 0 ? UP : DOWN } : {}, children: extras });
|
|
445
|
+
return /* @__PURE__ */ jsx(BarChart, { ...common, stacked: spec.stacked ?? false, ...spec.layout === "horizontal" ? { layout: "horizontal" } : {}, ...spec.colorBySign ? { getBarColor: (v) => v >= 0 ? UP : DOWN } : {}, children: extras });
|
|
445
446
|
case "sparkline": {
|
|
446
447
|
const s = series[0];
|
|
447
448
|
const vals = (s?.data ?? []).filter((v) => v !== null);
|
|
@@ -628,6 +629,7 @@ export function Chart() {
|
|
|
628
629
|
if (spec.stacked) props.push("stacked");
|
|
629
630
|
if (spec.area && spec.area !== "none") props.push(`area=${lit(spec.area)}`);
|
|
630
631
|
if (spec.curve) props.push(`curve=${lit(spec.curve)}`);
|
|
632
|
+
if (spec.type === "bar" && spec.layout === "horizontal") props.push('layout="horizontal"');
|
|
631
633
|
if (spec.type === "bar" && spec.colorBySign) props.push("getBarColor={(v) => (v >= 0 ? '#F04452' : '#3182F6')}");
|
|
632
634
|
if (ys.length > 1 || spec.legend) props.push("legend");
|
|
633
635
|
const children = [
|
package/dist/spec.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface ChartSpec {
|
|
|
44
44
|
stacked?: boolean;
|
|
45
45
|
/** bar: red for ≥ 0, blue for < 0 (Korean convention). */
|
|
46
46
|
colorBySign?: boolean;
|
|
47
|
+
/** bar: 'horizontal' draws one row per category (rankings, sector returns). */
|
|
48
|
+
layout?: 'vertical' | 'horizontal';
|
|
47
49
|
showXAxis?: boolean;
|
|
48
50
|
showYAxis?: boolean;
|
|
49
51
|
legend?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Funnest Charts command line: list charts, validate JSON specs, render SVG/PNG/HTML, suggest charts for your data, generate React code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"react": "^19.3.1",
|
|
50
50
|
"react-dom": "^19.3.1",
|
|
51
|
-
"@funnest/charts-react": "0.
|
|
52
|
-
"@funnest/charts-viz": "0.
|
|
51
|
+
"@funnest/charts-react": "0.3.0",
|
|
52
|
+
"@funnest/charts-viz": "0.3.0"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
55
|
"@resvg/resvg-js": "^2.6.2"
|