gpt4 book ai didi

javascript - 负轴值使图表出现故障

转载 作者:行者123 更新时间:2023-12-01 01:25:08 25 4
gpt4 key购买 nike

考虑到提供的数据(用红色标记),我尝试创建图表,轴上的一些值按预期列出 enter image description here

但令我困惑的是,当我提供负值时(刚刚添加的相同值 - )它只在轴上显示 0 enter image description here

当提供正值数据时,是否有可能创建与我对正值相同的行为,因此在提供值时不会出现故障?

$(function() {
var chart = new Highcharts.Chart(


{
"meta": {
"drilldownEnabled": false
},
"chart": {
renderTo:"container",
"additionalData": {
"dateTime": false,
"datetype": "string",
"cliccable": true,
"drillable": false,
"drillableChart": false,
"isCockpit": true,
"categoryColumn": "product_name",
"categoryGroupBy": "",
"categoryGroupByNamens": "",
"categoryName": "product_name",
"categoryOrderColumn": "",
"categoryOrderType": "",
"categoryStacked": "",
"categoryStackedType": ""
},
"zoomType": "xy",
"panning": true,
"type": "column",
"options3d": {
"enabled": false,
"alpha": 25,
"beta": 15,
"depth": 50,
"viewDistance": 25
},
"backgroundColor": "#FFFFFF",
"heightDimType": "pixels",
"widthDimType": "pixels",
"plotBackgroundColor": null,
"plotBorderWidth": null,
"plotShadow": false,
"borderColor": "#FFFFFF",
"style": {
"backgroundColor": "#FFFFFF",
"fontFamily": "",
"fontWeight": "",
"fontSize": ""
},
"events": {}
},
"colors": [
"#7cb5ec",
"#434348",
"#90ed7d",
"#f7a35c",
"#8085e9",
"#f15c80",
"#e4d354",
"#2b908f",
"#f45b5b",
"#91e8e1"
],
"title": {
"text": "",
"style": {
"align": "",
"color": "",
"fontFamily": "",
"fontSize": "",
"fontWeight": ""
}
},
"legend": {
"itemDistance": 0,
"symbolPadding": 25,
"enabled": false
},
"xAxis": [
{
"plotBands": [
{
"label": {
"text": "",
"align": "center"
},
"color": "",
"from": 0,
"to": 0
}
],
"plotLines": [
{
"label": {
"text": "",
"align": "center"
},
"color": "",
"dashStyle": "",
"value": 0,
"width": 0
}
],
"type": "category",
"id": 0,
"title": {
"customTitle": false,
"text": "product_name",
"style": {}
},
"labels": {
"style": {
"color": "",
"fontFamily": "",
"fontSize": "",
"fontWeight": ""
},
"align": ""
}
}
],
"yAxis": [
{
"plotBands": [
{
"label": {
"text": "",
"align": "center"
},
"color": "",
"from": 0,
"to": 0
}
],
"plotLines": [
{
"label": {
"text": "",
"align": "center"
},
"color": "",
"dashStyle": "",
"value": 0,
"width": 0
}
],
"min": 0,
"title": {
"text": "store_sales",
"customTitle": false,
"style": {
"color": "",
"fontFamily": "",
"fontWeight": "",
"fontSize": ""
}
},
"labels": {
"style": {
"color": "",
"fontFamily": "",
"fontSize": "",
"fontWeight": ""
},
"align": ""
},
"gridLineDashStyle": "$convertedTypeline",
"minorGridLineDashStyle": "$convertedMinorTpeline"
}
],
"series": [
{
"name": "store_sales",
"dataLabels": {
"style": {
"color": "",
"fontFamily": "",
"fontWeight": "",
"fontSize": "",
"fontStyle": ""
},
"enabled": true,
"labelFormat": "{y:,.2f}"
},
"data": [
{
"drilldown": false,
"y": -6.36,
"name": "ADJ Rosy Sunglasses",
"datetype": "string"
},
{
"drilldown": false,
"y": -9.55,
"name": "Akron City Map",
"datetype": "string"
},
{
"drilldown": false,
"y": -12.55,
"name": "American Beef Bologna",
"datetype": "string"
},
{
"drilldown": false,
"y": -7.35,
"name": "American Chicken Hot Dogs",
"datetype": "string"
},
{
"drilldown": false,
"y": -12.19,
"name": "American Cole Slaw",
"datetype": "string"
},
{
"drilldown": false,
"y": -6.68,
"name": "American Corned Beef",
"datetype": "string"
},
{
"drilldown": false,
"y": -8.57,
"name": "American Foot-Long Hot Dogs",
"datetype": "string"
},
{
"drilldown": false,
"y": -6,
"name": "American Low Fat Bologna",
"datetype": "string"
},
{
"drilldown": false,
"y": -7.94,
"name": "American Low Fat Cole Slaw",
"datetype": "string"
},
{
"drilldown": false,
"y": -6.49,
"name": "American Pimento Loaf",
"datetype": "string"
}
],
"selected": true,
"tooltip": {
"valueDecimals": 2,
"scaleFactor": "empty",
"ttBackColor": "#FCFFC5"
},
"yAxis": 0
}
],
"tooltip": {
"borderWidth": 0,
"borderRadius": 0,
"followTouchMove": false,
"followPointer": true,
"useHTML": true,
"backgroundColor": null,
"style": {
"padding": 0
}
},
"lang": {
"noData": ""
},
"noData": {
"style": {
"fontFamily": "",
"fontSize": "",
"color": ""
},
"position": {
"align": "center",
"verticalAlign": "middle"
}
},
"credits": {
"enabled": false
},
"plotOptions": {
"line": {
"marker": {
"symbol": "circle",
"lineWidth": 2
}
},
"series": {
"events": {},
"showCheckbox": true,
"cursor": "pointer",
"point": {
"events": {}
},
"dataLabels": {
"allowOverlap": true
},
"turboThreshold": 2000
}
}
}





);
});

这是负面的片段(有故障) http://jsfiddle.net/JeLrb/532这是一个相同的片段,只是带有正数(轴值应如何显示) http://jsfiddle.net/JeLrb/533/

有人知道这个问题的解决方案吗?谢谢!

最佳答案

删除 yAxis:“min:0”,它将为您创建负 yAxis 数据标签。请检查

 "yAxis": [
{
/*"min": 0, remove this */
"title": {
"text": "store_sales",
"customTitle": false,
"style": {
"color": "",
"fontFamily": "",
"fontWeight": "",
"fontSize": ""
}
}
}

]

http://jsfiddle.net/98b0dkLj

关于javascript - 负轴值使图表出现故障,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53873294/

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