1

我的 JQPlot 图表当前正在正确呈现所有内容,但唯一的问题是图表与刻度标签重叠。无论如何我可以抵消标签以防止这种情况发生或简单的选项更改?我在 JQPlot 网站上没有找到任何关于此的信息,因此我们将不胜感激。这是一些示例代码:

var moduleTypesChart = $.jqplot("moduleTypesChart",[moduleTypesCount], {
                            title:'<h2>Module Types Distribution</h2>',
                            seriesColors:["darkred"],
                            seriesDefaults:{
                                renderer:$.jqplot.BarRenderer,
                                rendererOptions: {fillToZero: true, varyBarColor: false}
                            },
                            axesDefaults:{
                                tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                                tickOptions:{
                                    angle: -15,
                                    textColor:'black',
                                    labelPosition:'middle',
                                    fontFamily:"Arial",
                                    fontWeight:"bold"
                                }
                            },
                            axes: {
                                xaxis: {
                                    renderer: $.jqplot.CategoryAxisRenderer,
                                    ticks: moduleTypes
                                }
                            },
                            grid: {
                                background:'Gainsboro',
                                gridLineColor:'LightSteelBlue'
                            }
4

1 回答 1

4

您可以通过修改 CSS 来做到这一点。

在您的 jqPlot 目录中有两个文件:jquery.jqplot.cssjquery.jqplot.min.css

里面是一个用于 y 轴标签的 CSS 类:

.jqplot-yaxis-label {
    margin-right: 20px;
    font-size: 11pt;
    position: absolute;
}

您可以增加右边距以避免与刻度重叠。

请记住确保链接到 HTML 文档头部中的这些文件之一,例如:

<link rel='stylesheet' type='text/css' href='/DHTML/jqplot/jquery.jqplot.css'>
于 2012-10-08T15:28:36.460 回答