javascript - 饼图中的颜色不尊重设置
问题描述
我们已经设置了饼图,我想更改条形图的颜色,但它们仍然相同, 我希望颜色与此不同。应该是橄榄色/卡其色...
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);
}
解决方案
推荐阅读
- java - 如何在Androidplot中填充两个系列之间的区域?
- javascript - 如何打印 ReactVirtualized Grids?
- node.js - TypeError: Cannot read property 'roles' of null (when dm the bot)
- angular - 504 从服务器读取响应时超时
- amazon-web-services - 哪些情况会导致 AppSync 无法从 DynamoDB 表中返回所有匹配的记录/项目?
- python - 适合此操作的最佳代码是什么?
- go - 执行带有奇怪字符的命令时遇到问题
- javascript - 在 JavaScript 中将缓冲区转换为整数
- sql - 具有多个匹配项的基于 SQL Server 集的更新
- ssis - 在 SMTP 连接管理器上的 Foreach 循环错误中发送带有脚本任务的电子邮件