【发布时间】:2022-11-23 05:37:10
【问题描述】:
版本 1
如果我在 PowerShell 中执行以下操作:
$json = @"
{
"chart": {
"data": {
"labels": [
"2022-06-30",
"2022-07-01",
"2022-07-05",
"2022-07-06",
"2022-07-07"
],
"datasets": [
{
"data": [
5801404000000.0,
6060626000000.0,
6085791000000.0,
6035882000000.0,
6053350000000.0
],
"label": "Net Liquidity"
}
]
},
"options": {
"scales": {}
},
"type": "bar"
}
}
"@
Invoke-RestMethod -Method Post -Uri 'https://quickchart.io/chart' -Body $json -ContentType 'application/json' -OutFile C:\temp\test-2.png
Start-Process C:\temp\test-2.png
我得到以下信息:
看起来不错!请注意,y 轴已适当缩放。
版本 2
但是,如果我改为执行以下操作:
$json = @"
{
"chart": {
"data": {
"labels": [
"2022-06-30",
"2022-07-01",
"2022-07-05",
"2022-07-06",
"2022-07-07"
],
"datasets": [
{
"data": [
5801404000000.0,
6060626000000.0,
6085791000000.0,
6035882000000.0,
6053350000000.0
],
"label": "Net Liquidity"
}
]
},
"options": { },
"type": "bar"
}
}
"@
Invoke-RestMethod -Method Post -Uri 'https://quickchart.io/chart' -Body $json -ContentType 'application/json' -OutFile C:\temp\test-2.png
Start-Process C:\temp\test-2.png
我得到以下信息:
请注意,y 轴现在从 0 开始。
差异
版本 1 使用:
"options": {
"scales": {}
},
而版本 2 使用:
"options": { },
问题
这是快速图表中的错误吗?还是这种行为是故意的?如果是这样,这是否记录在某处?
【问题讨论】:
标签: quickchart