gpt4 book ai didi

javascript - 美图 : Long label inside bar chart does not show

转载 作者:行者123 更新时间:2023-11-30 14:52:19 25 4
gpt4 key购买 nike

我正在尝试在 AmChart 图表的条形内放置一个标签。如果标签太长,则不会显示。请查看 JsFiddle,https://jsfiddle.net/o3518u19/4/ ,

var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "light",
"categoryField": "year",
"startDuration": 1,
"categoryAxis": {
"gridPosition": "start",
"position": "left"
},
"columnSpacing": 0,
"columnWidth": 0.6,
"graphs": [ {
"balloonText": "Income:[[value]]",
"labelText": "HEJ",
"labelPosition": "inside",
"labelRotation": 270,
"color": "#fff",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"title": "Income",
"type": "column",
"valueField": "income",
"fixedColumnWidth": 25
},
{
"balloonText": "Income:[[value]]",
"labelRotation": 270,
"labelText": "HEJA",
"labelPosition": "inside",
"color": "#fff",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"title": "Income",
"type": "column",
"valueField": "income",
"fixedColumnWidth": 25
}],
"valueAxes": [ {
"stackType": "regular",
"position": "top",
"axisAlpha": 0
} ],
"dataProvider": [ {
"year": 2005,
"income": 23.5,
"expenses": 18.1
}, {
"year": 2006,
"income": 26.2,
"expenses": 22.8
}]
} );

其中显示“HEJ”而不是“HEJA”。我不想让列宽于 25。

最佳答案

使用 "showAllValueLabels":true, 这将显示较长的标签并在它们适合时覆盖检查。

{
"balloonText": "Income:[[value]]",
"labelRotation": 270,
"labelText": "HEJA",
"showAllValueLabels":true, /// add this line
"labelPosition": "inside",
"color": "#fff",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"title": "Income",
"type": "column",
"valueField": "income",
"fixedColumnWidth": 25
}

此外,您可以使用 "labelOffset" 进一步调整标签的位置(在您的情况下是垂直的)

关于javascript - 美图 : Long label inside bar chart does not show,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47925054/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com