首页 文章

jqplot条形图点标签字体大小

提问于
浏览
0

我有一个水平条形图 . 我可以设置轴的字体大小,但不能设置pointlabel . 怎么能实现这一目标?

谢谢

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'
                    }
                },
                axes: {
                    xaxis: {                                                        
                        tickOptions: {
                            fontSize: '30pt'
                        }                           
                    }, 
                    yaxis: {
                        renderer: $.jqplot.CategoryAxisRenderer,

                        tickOptions: {
                            fontSize: '30pt'                                
                        }
                    }
                }
            });

1 回答

  • 0

    当您使用pointLabels plugin时,您需要使用CSS设置标签样式 . 您可以添加以下CSS:

    #chart1 .jqplot-point-label {
      font-size: 30pt;
    }
    

    其中 chart1 是图表的ID . 这会将点标签 font-size 设置为30pt .

    有关正常工作的演示,请参阅this Fiddle .

相关问题