Jqplot饼图的背景颜色 [英] background color for Jqplot pie chart

查看:83
本文介绍了Jqplot饼图的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请给我一个页面,在页面中我有两个饼图,(我使用Jqplot饼图)
我想为2个图表显示不同的背景颜色,但它嵌入在CSS文件中!
有没有使用任何颜色的选择?或使其透明?
我的代码:

PieTimer [index] = jQuery.jqplot(PieTimerId,
TimerValuesArray,
{
seriesDefaults:{
阴影:假,
seriesColors:[#13e837",#6e869b"],
渲染器:jQuery.jqplot.PieRenderer,
rendererOptions:{
highlightMouseOver:false,
直径:40,
填充:0,
showDataLabels:否,
startAngle:270,
sliceMargin:0,
shadowOffset:0,
shadowAlpha:0,
shadowDepth:0,
drawBorder:false,
阴影:假,
borderWidth:0
}
},
图例:{显示:false,位置:"w"}//
}

);

我想知道在绘制图表时是否可以设置属性(例如:backgroundcolor ...)?
10x

Hi all,

Kindly i have a page and in the page i have two pie charts, (i''m using Jqplot pie chart)
i want to display different background color for the 2 charts but it is embeded in the css file!
is there any option to use any color?? or to make it transparent?
my code:

PieTimer[index] = jQuery.jqplot(PieTimerId,
TimerValuesArray,
{
seriesDefaults: {
shadow: false,
seriesColors: ["#13e837", "#6e869b"],
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
highlightMouseOver: false,
diameter: 40,
padding: 0,
showDataLabels: false,
startAngle: 270,
sliceMargin: 0,
shadowOffset: 0,
shadowAlpha: 0,
shadowDepth: 0,
drawBorder: false,
shadow: false,
borderWidth: 0
}
},
legend: { show: false, location: ''w''}//
}

);

i''m wondering if i can set a property (ex: backgroundcolor ...) when drawing the chart?
10x

推荐答案

对于所有感兴趣的人
我在js文件中进行了更改:jquery.jqplot.min.js以下

旧:this.background =#fffdf6"
新增:this.background ="transparent"
for all who are interested
i changed in the js file: jquery.jqplot.min.js the following

old: this.background = "#fffdf6"
new: this.background = "transparent"


另一种方式:

another way:

According to the jqPlot options page (http://www.jqplot.com/docs/files/jqPlotOptions-txt.html) you have a option called grid where you can set all the grid parameters, one of this parameters is background color.
grid: {
    drawGridLines: true,        // wether to draw lines across the grid or not.
    gridLineColor: '#cccccc'    // *Color of the grid lines.
    background: '#fffdf6',      // CSS color spec for background color of grid.
    borderColor: '#999999',     // CSS color spec for border around grid.
    borderWidth: 2.0,           // pixel width of border around grid.
    shadow: true,               // draw a shadow for grid.
    shadowAngle: 45,            // angle of the shadow.  Clockwise from x axis.
    shadowOffset: 1.5,          // offset from the line of the shadow.
    shadowWidth: 3,             // width of the stroke for the shadow.
    shadowDepth: 3,             // Number of strokes to make when drawing shadow.
                                // Each stroke offset by shadowOffset from the last.
    shadowAlpha: 0.07           // Opacity of the shadow
    renderer:


.jqplot.CanvasGridRenderer,//用于绘制网格的渲染器. rendererOptions:{} // 选项传递给渲染器.请注意,默认 // CanvasGridRenderer不需要其他选项. }, 一个 示例 是: var plot1 = jqplot ("chart1",[数据], { seriesDefaults : { //将其设为饼图. 渲染器:jQuery.jqplot.PieRenderer } 网格 : { drawGridLines:true,//是否在网格上绘制线条. gridLineColor:'#cccccc',//*网格线的颜色. background:'#ffff66',//网格背景颜色的CSS颜色规范. borderColor:'#999999',//网格边框的CSS颜色规范. borderWidth:2.0,//网格周围边框的像素宽度. shadow:true,//为网格绘制阴影. shadowAngle:45,//阴影的角度.从x轴顺时针旋转. shadowOffset:1.5,//从阴影线开始的偏移量. shadowWidth:3,//阴影的笔触宽度. shadowDepth:3 } 传奇 : {show:true,位置:"e" } } );
.jqplot.CanvasGridRenderer, // renderer to use to draw the grid. rendererOptions: {} // options to pass to the renderer. Note, the default // CanvasGridRenderer takes no additional options. }, An example of usage is: var plot1 = jQuery.jqplot ('chart1', [data], { seriesDefaults: { // Make this a pie chart. renderer: jQuery.jqplot.PieRenderer }, grid: { drawGridLines: true, // wether to draw lines across the grid or not. gridLineColor: '#cccccc', // *Color of the grid lines. background: '#ffff66', // CSS color spec for background color of grid. borderColor: '#999999', // CSS color spec for border around grid. borderWidth: 2.0, // pixel width of border around grid. shadow: true, // draw a shadow for grid. shadowAngle: 45, // angle of the shadow. Clockwise from x axis. shadowOffset: 1.5, // offset from the line of the shadow. shadowWidth: 3, // width of the stroke for the shadow. shadowDepth: 3 }, legend: { show:true, location: 'e' } } );


这篇关于Jqplot饼图的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆