2

以下は私のコードです....

以下の例では、ターゲット値 2.5 よりも低い値を持つ 2 つのバーがあります..これらは赤色で表示する必要があります..

$(document).ready(function(){
  var line1 = [['Content Of The Training', 2.2], ['Relavance Of Training To The Work Place', 3.5], ['Phase Of The Training', 3.2], 
  ['Session Met The Objectives Stated', 3.4], [' The Session Met My Exceptations', 3], 
  ['Overall Ratining On the Training', 2.1]];

  var plot1 = $.jqplot('graph1', [line1], {
    title: 'Rating On Training',
    series:[{renderer:$.jqplot.BarRenderer}],
    axesDefaults: {
        tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
        tickOptions: {
        fontFamily: 'Calibri',
          angle: -30,
          fontSize: '10pt'
        }
    },

axes: {
  xaxis: {
    renderer: $.jqplot.CategoryAxisRenderer
  }
},
    canvasOverlay: {
  show: true,
  objects: [
    {horizontalLine: {
      name: 'pebbles',
      y: 2.5,
      lineWidth: 2,
      color: 'rgb(255, 0, 0)',
      shadow: true,
      lineCap: 'butt',
      xOffset: 0
    }},

  ]
}
  });
});
4

1 に答える 1

2

次のように関数を変更して上記を実行しました

var barColorSetter = function(indexVal, ratingValue, limit)
{
    if(ratingValue<limit)
    {
        myBarColors[indexVal]="#750000";//maroon
    }
    else if(ratingValue == limit)
    {`enter code here`
        //myBarColors[indexVal]="#7399D2";//Blue
                myBarColors[indexVal]="#FF7E00";//traffic Yellow(amber color)
    }
    else
    {
        myBarColors[indexVal]="#135F0E";//green
    }   
}

そして、設定された色の値を上記のメソッドに渡しました....ありがとうございました

于 2013-09-05T09:54:39.007 に答える