【问题标题】:chartkick chart.js change colour of axis and colour of axis titlechartkick chart.js 改变轴的颜色和轴标题的颜色
【发布时间】:2018-01-23 22:16:03
【问题描述】:

在我的 rails 应用程序中,我添加了一些图表并想将颜色从黑色更改(见图)。

这是我认为的代码:

<%= 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 %>  

图表的颜色正确,但轴标题是黑色的,轴也是。

【问题讨论】:

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


    【解决方案1】:

    好的,看起来chartkickchart.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"} } } %>   
    

    希望对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-01-10
      • 2019-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-20
      • 2010-12-31
      相关资源
      最近更新 更多