如何设置jqplot水平条形图的pointLabels字体大小?
解决jqPlot水平条形图PointLabels字体大小设置问题
你已经搞定坐标轴字体大小的设置啦,其实pointLabels的字体大小配置很简单,直接在它的配置项里添加fontSize参数就能实现!
把你的代码修改成下面这样,就能让数据标签的字体大小和坐标轴保持一致:
var plot2 = $.jqplot('chart2', [values], { seriesDefaults: { renderer: $.jqplot.BarRenderer, rendererOptions: { barDirection: 'horizontal', barPadding: 40, barMargin: 40, barWidth: 10 }, pointLabels: { show: true, location: 'e', edgeTolerance: -15, formatString: '%s', fontSize: '30pt' // 新增这一行,设置数据标签字体大小 } }, axes: { xaxis: { tickOptions: { fontSize: '30pt' } }, yaxis: { renderer: $.jqplot.CategoryAxisRenderer, tickOptions: { fontSize: '30pt' } // 若需要y轴字体统一也可添加 } } });
额外拓展:
如果之后想要调整数据标签的其他样式,还可以在pointLabels里添加这些参数:
fontFamily:设置字体类型,比如'Arial'fontWeight:设置字体粗细,比如'bold'textColor:设置字体颜色,比如'#333'
内容的提问来源于stack exchange,提问作者Prefijo Sustantivo
相关产品推荐
相关产品推荐

