首页 > 解决方案 > 饼图中的颜色不尊重设置

问题描述

我们已经设置了饼图,我想更改条形图的颜色,但它们仍然相同, 我希望颜色与此不同。应该是橄榄色/卡其色...

 google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);


function drawChart() {



   work = <xsl:value-of select="$holidayPay"/>; //Yearly Netto Salary
   eat = <xsl:value-of select="$totalCost"/>; //odvody SS na sociální a zdravotní pojištění
   commute = <xsl:value-of select="$yearlyBonusPayment"/>; //Annual Bonus
   tv = <xsl:value-of select="$pensionContribution"/>+<xsl:value-of select="$cafeteriaContribution"/>+<xsl:value-of select="$lunchContribution"/>+<xsl:value-of select="$customField2"/>+<xsl:value-of select="$Referral"/>; //Benefits Contribution 
   tc = <xsl:value-of select="$travelPay"/>+<xsl:value-of select="$sicknessPay"/>+<xsl:value-of select="$TrainingCosts"/>; //Training Costs
 

 var data = google.visualization.arrayToDataTable([
   ['Task', 'Hours per Week'],
      ['Yearly Netto Salary',    work],
      ['Look, what the state has stolen from your payslip',      eat],
      ['Annual Bonus',  commute],
      ['Benefits Contribution', tv],
      ['Training Costs', tc],

    ]);

    var options = {
      //title: 'Weekly Activities',
      colors: ['olive','darkolivegreen','khaki','darkkhaki','cornsilk']

    };


    var chart = new google.visualization.PieChart(document.getElementById('piechart'));
    chart.draw(data, null);

  }

标签: javascriptreact-google-charts

解决方案


推荐阅读