chartkick chart.js更改轴标题的颜色和轴标题的颜色

时间:2018-01-23 22:16:03

标签: colors ruby-on-rails-3.2 chart.js axis-labels chartkick

在我的rails应用程序中,我添加了一些图表,并想要改变黑色的颜色(见图) enter image description here

以下是我视图中的代码:

<%= line_chart $tweet_per_day, id: "line_chart $tweet_per_day", width: "400px", height: "300px", ytitle: "Tweets count", ytitleFontColor: ["pink", "#F76161"], colors: ["blue", "#76BDD1"], download: "top_hashtags", refresh: 60 %>  

图表颜色正确,但轴标题是黑色,因此是轴。

1 个答案:

答案 0 :(得分:1)

好的,似乎chartkick chart.js有一些limitations。所以我切换到google charts 我删除了我的application.html.erb和application.js中的chart.js代码,并将其替换为google chart code
更改我的折线图this page很有帮助 以下是我视图中的工作代码:

<%= line_chart $tweet_day, id:"line_chart $tweet_day",xtitle: "Day of the Week", ytitle: "Tweets Count", colors: ["#C2F4FF"], download: "tweet_day", refresh: 60, 
  library: { 
    vAxis: { baselineColor: "#F76161",  gridlines: {Color: "" }, textStyle: { color: "#76BDD1"}, titleTextStyle: {color: "#F76161"} }, 
    hAxis: { baselineColor: "#F76161" , gridlines: {Color: "" }, textStyle: { color: "#76BDD1"} , titleTextStyle: {color: "#F76161"} } } %>   
希望它对某人有所帮助。