当动力线在另一条线jqplot下方时,改变它的颜色

时间:2012-06-22 10:52:05

标签: dynamic colors jqplot lines

我制作了一个jqplot,其中有一行是动态创建的,来自一些问题和另外两个,行业标准和最佳实践行。

我希望能够在低于行业标准时更改动态创建的行的颜色,并且如果它超出最佳实践行,则再次更改它。

这是可能的,还是我想把它拿得太远?

提前感谢大家的回复。

这是我的一些代码:

//Get radio Values  var values = $('input:radio:checked').map(function () { 
  return this.value; }).get(); 


    var line1 =[[1,values[0]], [2,values[1]], [3,values[2]], [4,values[3]], [5,values[4]]];
var line2 =[[1,4],[2,5],[3,4],[4,5],[5,5]];
var line3 =[[1,1],[2,2],[3,2],[4,4],[5,4]];

  $.jqplot('chartdiv',  [line2,line1,line3],

{  title:'Best Practices Chart',   highlighter: {useAxesFormatters: true,       showTooltip: true,
tooltipLocation: 'nw',
lineWidthAdjust: 2.5, },

grid:{  
drawGridLines: true,
backgroundColor: '#FFFFFF'},//plot labels   axes:{yaxis:{ticks:['Poor','Low', 'Medium', 'High', 'Best Practice'],   renderer: $.jqplot.CategoryAxisRenderer,


xaxis:{ticks:['DP Officer', 'Policies & Procedures', 'Awareness & Education', 'Information Security', 'Data Quality'],   renderer: $.jqplot.CategoryAxisRenderer, 

seriesColors: ["#00FF00", "#000000", "#0000FF"],legend: {
        show: true,
      }, series: [

{markerOptions: {style:'dimaond'}, label: 'Best Practise'},
{label: 'Your Practise'},
{markerOptions: {style:'filledSquare'}, label: 'Average Practise'},],
    });
  }); });

1 个答案:

答案 0 :(得分:0)

The sample presents dynamical redrawing of a series. 在2秒后的样本中,第一个白色的线被重绘为黑色。您可以将它用于重绘,但请记住,in不会更改其默认属性,例如,当您按下按钮时,该行将以默认颜色重新绘制。