zinkee 0.1.20 → 0.1.21
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/index.js +98 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/displays.ts +2 -2
- package/src/utils/examples.ts +99 -6
package/package.json
CHANGED
package/src/commands/displays.ts
CHANGED
|
@@ -720,7 +720,7 @@ export function registerDisplaysCommands(
|
|
|
720
720
|
.option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
721
721
|
.option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button")
|
|
722
722
|
.option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>")
|
|
723
|
-
.option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series")
|
|
723
|
+
.option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series")
|
|
724
724
|
.option("--y-axis-serie <json>", "repeatable y axis serie", (v, p: string[] = []) => [...p, v], [])
|
|
725
725
|
.option("--legend <json>").option("--raw <json>").option("--raw-file <path>")
|
|
726
726
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, commandOptions: WidgetMutationOptions) {
|
|
@@ -738,7 +738,7 @@ export function registerDisplaysCommands(
|
|
|
738
738
|
.option("--filter <expr>", "repeatable filter", collectFilters, [])
|
|
739
739
|
.option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button")
|
|
740
740
|
.option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>")
|
|
741
|
-
.option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series")
|
|
741
|
+
.option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series")
|
|
742
742
|
.option("--y-axis-serie <json>", "repeatable y axis serie", (v, p: string[] = []) => [...p, v], [])
|
|
743
743
|
.option("--legend <json>").option("--raw <json>").option("--raw-file <path>")
|
|
744
744
|
.action(async function action(this: Command, display: NormalizedUuidOrSlug, widgetId: string, commandOptions: WidgetMutationOptions) {
|
package/src/utils/examples.ts
CHANGED
|
@@ -1385,9 +1385,40 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1385
1385
|
}`,
|
|
1386
1386
|
},
|
|
1387
1387
|
{
|
|
1388
|
-
description: "Create a
|
|
1388
|
+
description: "Create a CHART widget with a daily time-serie x-axis.",
|
|
1389
1389
|
command:
|
|
1390
|
-
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by
|
|
1390
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by day" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format DATE --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1391
|
+
raw: `{
|
|
1392
|
+
"type": "CHART",
|
|
1393
|
+
"source": {
|
|
1394
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1395
|
+
"isOriginSubSchema": false
|
|
1396
|
+
},
|
|
1397
|
+
"placement": {
|
|
1398
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1399
|
+
},
|
|
1400
|
+
"presentation": { "name": "Revenue by day" },
|
|
1401
|
+
"chart": {
|
|
1402
|
+
"chartType": "lines",
|
|
1403
|
+
"xAxisFieldId": "due-date",
|
|
1404
|
+
"xAxisDateFormat": "DATE",
|
|
1405
|
+
"xAxisAsTimeSerie": true,
|
|
1406
|
+
"yAxisSeries": [
|
|
1407
|
+
{
|
|
1408
|
+
"typeCalc": "SUM",
|
|
1409
|
+
"fieldCalc": "amount",
|
|
1410
|
+
"color": "#4B9CD3",
|
|
1411
|
+
"axisType": "PRIMARY"
|
|
1412
|
+
}
|
|
1413
|
+
],
|
|
1414
|
+
"legend": { "position": "bottom" }
|
|
1415
|
+
}
|
|
1416
|
+
}`,
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
description: "Create a bars CHART widget with a monthly time-serie x-axis and two y-axis series.",
|
|
1420
|
+
command:
|
|
1421
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by month" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format MONTH_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --y-axis-serie '{"typeCalc":"COUNT","fieldCalc":"id","color":"#E57373","axisType":"SECONDARY"}' --legend '{"position":"bottom"}'`,
|
|
1391
1422
|
raw: `{
|
|
1392
1423
|
"type": "CHART",
|
|
1393
1424
|
"source": {
|
|
@@ -1401,7 +1432,7 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1401
1432
|
"chart": {
|
|
1402
1433
|
"chartType": "bars",
|
|
1403
1434
|
"xAxisFieldId": "due-date",
|
|
1404
|
-
"xAxisDateFormat": "
|
|
1435
|
+
"xAxisDateFormat": "MONTH_YEAR",
|
|
1405
1436
|
"xAxisAsTimeSerie": true,
|
|
1406
1437
|
"yAxisSeries": [
|
|
1407
1438
|
{
|
|
@@ -1419,6 +1450,68 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1419
1450
|
],
|
|
1420
1451
|
"legend": { "position": "bottom" }
|
|
1421
1452
|
}
|
|
1453
|
+
}`,
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
description: "Create a bars CHART widget with a quarterly time-serie x-axis.",
|
|
1457
|
+
command:
|
|
1458
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by quarter" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1459
|
+
raw: `{
|
|
1460
|
+
"type": "CHART",
|
|
1461
|
+
"source": {
|
|
1462
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1463
|
+
"isOriginSubSchema": false
|
|
1464
|
+
},
|
|
1465
|
+
"placement": {
|
|
1466
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1467
|
+
},
|
|
1468
|
+
"presentation": { "name": "Revenue by quarter" },
|
|
1469
|
+
"chart": {
|
|
1470
|
+
"chartType": "bars",
|
|
1471
|
+
"xAxisFieldId": "due-date",
|
|
1472
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
1473
|
+
"xAxisAsTimeSerie": true,
|
|
1474
|
+
"yAxisSeries": [
|
|
1475
|
+
{
|
|
1476
|
+
"typeCalc": "SUM",
|
|
1477
|
+
"fieldCalc": "amount",
|
|
1478
|
+
"color": "#4B9CD3",
|
|
1479
|
+
"axisType": "PRIMARY"
|
|
1480
|
+
}
|
|
1481
|
+
],
|
|
1482
|
+
"legend": { "position": "bottom" }
|
|
1483
|
+
}
|
|
1484
|
+
}`,
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
description: "Create a CHART widget with a yearly time-serie x-axis.",
|
|
1488
|
+
command:
|
|
1489
|
+
`zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by year" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
1490
|
+
raw: `{
|
|
1491
|
+
"type": "CHART",
|
|
1492
|
+
"source": {
|
|
1493
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
1494
|
+
"isOriginSubSchema": false
|
|
1495
|
+
},
|
|
1496
|
+
"placement": {
|
|
1497
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
1498
|
+
},
|
|
1499
|
+
"presentation": { "name": "Revenue by year" },
|
|
1500
|
+
"chart": {
|
|
1501
|
+
"chartType": "lines",
|
|
1502
|
+
"xAxisFieldId": "due-date",
|
|
1503
|
+
"xAxisDateFormat": "YEAR",
|
|
1504
|
+
"xAxisAsTimeSerie": true,
|
|
1505
|
+
"yAxisSeries": [
|
|
1506
|
+
{
|
|
1507
|
+
"typeCalc": "SUM",
|
|
1508
|
+
"fieldCalc": "amount",
|
|
1509
|
+
"color": "#4B9CD3",
|
|
1510
|
+
"axisType": "PRIMARY"
|
|
1511
|
+
}
|
|
1512
|
+
],
|
|
1513
|
+
"legend": { "position": "bottom" }
|
|
1514
|
+
}
|
|
1422
1515
|
}`,
|
|
1423
1516
|
},
|
|
1424
1517
|
{
|
|
@@ -1580,14 +1673,14 @@ const specificExamples: Record<string, readonly CommandExample[]> = {
|
|
|
1580
1673
|
}`,
|
|
1581
1674
|
},
|
|
1582
1675
|
{
|
|
1583
|
-
description: "Replace the chart series with
|
|
1676
|
+
description: "Replace the chart series with quarterly lines.",
|
|
1584
1677
|
command:
|
|
1585
|
-
`zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format
|
|
1678
|
+
`zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#2E7D32","axisType":"PRIMARY"}'`,
|
|
1586
1679
|
raw: `{
|
|
1587
1680
|
"chart": {
|
|
1588
1681
|
"chartType": "lines",
|
|
1589
1682
|
"xAxisFieldId": "due-date",
|
|
1590
|
-
"xAxisDateFormat": "
|
|
1683
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
1591
1684
|
"xAxisAsTimeSerie": true,
|
|
1592
1685
|
"yAxisSeries": [
|
|
1593
1686
|
{
|