条形图上的标签丢失

编程入门 行业动态 更新时间:2024-10-06 08:31:53
本文介绍了条形图上的标签丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何确保所有条形标签都可见?该图表显示了其他所有标签.还要注意,其他所有条上也缺少数字标签.这是字体大小问题还是其他问题?

How do I go about ensuring that all of the labels for the bars are visible? This chart is showing every other label. Notice as well, that the numeric labels are missing on every other bar as well. Is this a font size issue, or something else?

jsfiddle/brookssh/a0xdsc3q/

var chart = new Highcharts.Chart({ chart: { renderTo: "chartContainer", defaultSeriesType: 'bar', height: 595 }, title: { text: '18 York Street Consumption (RankIt)', style: { color: '#484a4a', fontSize: '22px', fontFamily: 'Arial, Helvetica, sans-serif', fontWeight: 'bold' } }, subtitle: { text: 'Saturday, August 15 2015 through Sunday, August 16 2015' }, credits: { enabled: false }, yAxis: { allowDecimals: false, title: { text: "Test", style: { color: '#0063A2', fontFamily: 'Arial, Helvetica, sans-serif', fontWeight: 'bold' } }, plotLines: [{ color: 'red', // Color value value: null, // Value of where the line will appear width: 2 // Width of the line }], min: 0 }, xAxis: [{ categories: ['9th Floor Total kWh', '9th Floor', '8th Floor Lighting Total kWh', '8th Floor', '7th Floor Lighting Total kWh', '7th Floor', '6th Floor Total kWh', '5th Floor Total kWh', '5th Floor', '4th Floor Total kWh', '4th Floor', '3rd Floor Total kWh', '3rd Floor', '26th Floor Total kWh', '26th Floor', '25th Floor Total kWh', '25th Floor', '24th Floor Total kWh', '24th Floor', '23rd Floor Total kWh', '23rd Floor', '22nd Floor Total kWh', '22nd Floor', '21st Floor Total kWh', '21st Floor', '20th Floor Total kWh', '20th Floor', '19th Floor Total kWh', '19th Floor', '18th Floor Total kWh', '18th Floor', '17th Floor Total kWh', '17th Floor', '16th Floor Total kWh', '16th Floor', '15th Floor Total kWh', '15th Floor', '14th Floor Total kWh', '14th Floor', '13th Floor Total kWh', '13th Floor', '12th Floor Total kWh', '12th Floor', '11th Floor Total kWh', '11th Floor', '10th Floor Total kWh', '10th Floor'], title: { }, type: 'category', plotBands: [{ color: '#DDECFF', from: 1439571600000, to: 1439744400000 }], plotLines: [{ color: 'grey', // Color value dashStyle: "dash", value: null, // Value of where the line will appear width: 0 // Width of the line }], }, { labels: { rotation: -45, enabled: false }, lineWidth: 0, }], exporting: { enabled: false }, legend: { enabled: false }, plotOptions: { series: { colorByPoint: true }, spline: { enableMouseTracking: true, animation: { duration: 1500 }, marker: { enabled: false, states: { hover: { enabled: true, symbol: 'circle', radius: 5, lineWidth: 1 } } } } }, tooltip: { yDecimals: 2, formatter: function () { return tooltipFormat(this.x, null, this.y, yAxisTitle); } }, series: [{ data: [157, 169, 159, 173, 194, 203, 178, 144, 155, 411, 421, 275, 288, 266, 400, 214, 225, 142, 158, 112, 124, 114, 130, 112, 127, 134, 150, 107, 124, 143, 158, 85, 103, 99, 123, 174, 191, 327, 365, 221, 237, 241, 255, 310, 370, 133, 145], dataLabels: { enabled: true, color: '#000', style: { fontSize: '10px', verticalAlign: 'middle' } } }] });

推荐答案

您可以使用 plotOptions.series.dataLabels 的> allowOverlap 属性可强制显示每个标签:

You can use allowOverlap attribute of plotOptions.series.dataLabels to force the display of each labels :

plotOptions: { series: { colorByPoint: true, dataLabels: { allowOverlap: true } }, /* ... */ }

在此处查看您的正在使用JSFiddle的.

更多推荐

条形图上的标签丢失

本文发布于:2023-07-18 08:12:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142729.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:条形   图上   标签

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!