原創|使用教程|編輯:龔雪|2014-04-24 10:08:47.000|閱讀 23328 次
概述:本文為JavaScript圖表Highcharts使用教程第5節,為大家講解如何在Highcharts中設置背景顏色 以及漸變顏色。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
本文講解交互式JavaScript圖表Highcharts圖表區域的背景顏色和漸變設置。其顏色默認為 "#FFFFFF"。
JavaScrip代碼:
$(function () { $('#container').highcharts({ chart: { backgroundColor: '#FCFFC5', type: 'line' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { }, legend: { layout: 'vertical', backgroundColor: '#FFFFFF', floating: true, align: 'left', x: 100, verticalAlign: 'top', y: 70 }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; } }, plotOptions: { }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); });
JavaScrip代碼:
$(function () { $('#container').highcharts({ chart: { backgroundColor: { linearGradient: [0, 0, 500, 500], stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(200, 200, 255)'] ] }, type: 'line' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { }, legend: { layout: 'vertical', backgroundColor: '#FFFFFF', floating: true, align: 'left', x: 100, verticalAlign: 'top', y: 70 }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y; } }, plotOptions: { }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); });
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網