chartkick

Add annotations with Chartkick

六眼飞鱼酱① 提交于 2021-01-27 11:44:57
问题 I want to add annotations to my time series chart. From Google's documentation: data.addColumn({type:'string', role:'annotation'}); How can I pass these column properties through Chartkick? <%= line_chart [{name: 'annotations', data: annotations_array},{name: 'numbers as a time series', data: 'numeric_array'}] %> 回答1: I created a pull request to the chartkick.js repo to add the functionality you're describing. https://github.com/ankane/chartkick.js/pull/58 This is just for the JS library

Vue ChartKick - different colours for bar chart

女生的网名这么多〃 提交于 2020-12-12 07:02:47
问题 I use a vertical bar chart and I want to specify different colors for each bar: main.js import Chartkick from 'vue-chartkick'; import Chart from 'chart.js'; Vue.use(Chartkick.use(Chart)); File.vue <column-chart :data="chartData" width="800px" :colors="['#0b6e00', '#006ca2', '#ff3333', '#d60001']"></column-chart> But only the first color is used and all bars have the same colour. I tried to pass a :library attribute with backGround colour parameter as well without luck. Line chart accepts

Google Charts - No data available - Able to display a blank chart?

↘锁芯ラ 提交于 2020-02-25 05:45:25
问题 How can I still have Google Charts still show a line chart if my data array looks like this? [['Date','Line']] i.e. just the axis are defined. Most of my charts have data imported but some have nil on the data. I would like to display a blank chart. With data above I get an error message instead of a chart. Here is code in my view google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization

How to show count of data along with percentage in chartkicks in rails

自闭症网瘾萝莉.ら 提交于 2019-12-31 03:53:05
问题 Using chartkicks for showing charts. It show percentage only . I want to show count/amount along with percentage. <%= pie_chart visits.group(:country).count %> 回答1: Chartkick gem is a wrapper on top of Google Charts . By using library option you can specify what value to show in the legend and set other configuration options. So something like: <%= pie_chart visits.group(:country).count, library: {pieSliceText: 'value-and-percentage'} %> See this link for more configuration options: https:/

Rails 5 - ExecJS::RuntimeError

做~自己de王妃 提交于 2019-12-25 13:43:12
问题 My project was working fine, I was tweaking a chart made with chartkick and updating a HTML badge with ActionCable, when suddenly I get this error: ExecJS::RuntimeError in Pages#create_session Showing B:/.../app/views/layouts/application.html.erb where line #7 raised: SyntaxError: [stdin]:14:32: unexpected end of input Extracted source (around line #7): 5 <%= csrf_meta_tags %> 6 <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %> 7 <%= javascript_include_tag 'application'

Rails: Remove white border from Pie Chart using Chartkick Gem

允我心安 提交于 2019-12-24 14:27:42
问题 Is there a way to remove the white border from the pie chart slices by adding an option to the library? I've got a snippet of the code I used to create this chart. <%= pie_chart monthly(current_user.events), colors: colors_group, width: "200px", height: "200px", library:{animation:{easing: 'easeOutQuad'}} %> Thank you in advance! 回答1: Try setting the borderWidth option to 0 : <%= pie_chart monthly(current_user.events), colors: colors_group, width: "200px", height: "200px", library: {animation

How to change the color of a Column-chart created with Chartkick?

╄→гoц情女王★ 提交于 2019-12-23 12:53:50
问题 Is it possible to change the color of a Column-Chart created with Chartkick ? I searched for it inside the Documentation but i could not find anything about it. Any Ideas? 回答1: For Google Charts, use the library option to change the color of the entire series. <%= column_chart data, :library => {:colors => ["red"]} %> There's not an easy way to change each bar in a single series at the moment. https://developers.google.com/chart/interactive/docs/gallery/columnchart 回答2: I think it might work

How to hide axis using Chartkick.js

依然范特西╮ 提交于 2019-12-23 02:25:06
问题 I am using https://github.com/ankane/vue-chartkick to draw Vue charts, but looks like it didn't say how to hide axis from there document. Does anyone know how to do it in this library? Thanks in advance. 回答1: The chart component has a library property that allows you to customize the options for the chart. To hide / remove the x-axis for a line chart would look like this: <line-chart :data="lineData" :library="chartOptions"> ...and in your component... data () { return { lineData: [ {name:

Sinatra and Chartkick Example

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 08:56:08
问题 I am quite new to Ruby as web platform and learn best by adapting and expanding examples. I like Sinatra and want to use it and Chartkick to display charts. Unfortunately, I'm having trouble getting even the most trivial example running and there seems to be a dearth of full examples (lots of 'one liners'). Here's what I have: require 'sinatra' require 'chartkick' get '/' do '<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %> <%= pie_chart({"Football" => 10, "Basketball" => 5

Associations with Chartkick & Rails

眉间皱痕 提交于 2019-12-11 12:39:49
问题 I want to use chartkick to create a line graph of records, which belong to a planned task. In other words: plantask has_many records Records has two fields I'm interested in graphing. The created_at, which will be my X-axis, and data(An integer), which will be my Y-axis. So far I've gotten pretty close. By inserting this into my view: <%= line_chart @plantask.records.group_by_day(:created_at).sum(:data) %> I can see that my x-axis is displaying perfectly. However, it appears that the y-axis