chartkick

Rails 4: Removing grid lines chartkick?

和自甴很熟 提交于 2019-12-11 03:25:48
问题 Hi I am trying to make that code work in order to remove both axis using Chartkick with rails 4: <%= line_chart Score.where(employee_id: params[:id]).limit(10).group(:created_at).sum(:average), :library => {hAxis: {lineColor: 'transparent'}, vAxis: {lineColor: 'transparent'}, title: "#{@employee.name} latest results"}, max: 5.5, min: 0%> But it does not work here is what I get: I just want the blue line, I do not want the grid lines and the axis names. thanks for your help. 回答1: I found the

ChartKick Show original value rather percentage in PIE and line chart

梦想与她 提交于 2019-12-11 02:28:21
问题 I've data like graph_data = { "Commercial"=>364, "Residential"=>463, "Hospitality"=>150, "Industrial"=>20, "Laboratory"=>1 } pie_chart graph_data when I add this in the pie chart, it displays the chart with percentage of each option, I wan to display the value rather percentage, How i can do this, I'm using Chartkick gem with ruby on rails 4 回答1: Chartkick uses Google Visualization library to draw charts. Here is options description: https://developers.google.com/chart/interactive/docs

Rails, Chartkick: Show values on the charts

霸气de小男生 提交于 2019-12-10 18:28:27
问题 The Chartkick gem lets you create many kinds of charts. Currently, my charts look like this: pie_chart @institutions column_chart @stats I want that values are shown on the charts. In the pie chart, I want the number 244 and 43 be visible in or outside of the pie chart. In the column chart, I'd like to have the values on top or in the column. Is this somehow possible? Regarding to the pie chart, there is already a stackoverflow-question, but the accepted answer does nothing for me: pie_chart

Chartkick column charts multiple colors

不羁岁月 提交于 2019-12-06 03:05:47
问题 I'm using chartckick in my RoR project to generate charts, which works quite nice. (along with Google Charts). I've created a column chart with only 2 bars (male and female). And now the client wants that each bar have different color? Is that possible? I've seen this post - How to change the color of a Column-chart created with Chartkick? but it's more then half of year old and I'm hoping that there is a way now to specify more colors to the bars. Update My code looks like: Controller

Sinatra and Chartkick Example

◇◆丶佛笑我妖孽 提交于 2019-12-05 18:19:37
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}) %>' end So what devastatingly simple thing am I doing wrong? Any help would be greatly appreciated.

Rails chartkick: want only integer values on axes. Use discrete or something else?

久未见 提交于 2019-12-04 11:54:09
问题 Say I have the following code <% data = [ [1,1],[2,3],[3,5],[4,8],[6,4],[7,2] ] %> <%= line_chart data, {discrete: true, library: {width: 600} }%> Using chartkick, this produces the following graph I want the vertical axis to be labeled using integers. (not decimals) I thought that the discrete option was supposed to do this but for this example all it did was change the format of the elements on the horizontal axis from time to number (i.e. the following code <%= line_chart data, {library:

Rails chartkick: want only integer values on axes. Use discrete or something else?

佐手、 提交于 2019-12-03 07:28:40
Say I have the following code <% data = [ [1,1],[2,3],[3,5],[4,8],[6,4],[7,2] ] %> <%= line_chart data, {discrete: true, library: {width: 600} }%> Using chartkick, this produces the following graph I want the vertical axis to be labeled using integers. (not decimals) I thought that the discrete option was supposed to do this but for this example all it did was change the format of the elements on the horizontal axis from time to number (i.e. the following code <%= line_chart data, {library: {width: 600} }%> produces this ). So my question is: what exactly does discrete do, other than change

Rails 5.1, chartkick a sum with multiple currencies

三世轮回 提交于 2019-12-02 16:40:05
问题 I'm stuck on a tiny problem regarding chartkick. I have a rail app where you can create different currencies. You can then create a expense with a title, a amount and choose the currency from a list and the user_id. The relations are made and working. I have in my user controller something like this : @user_spendings = @current_user.spendings.all.order('date DESC').paginate(:page => params[:page], :per_page => 15) @sums_by_currency = Currency.joins(:spendings). select(:symb, 'SUM(spendings

Rails: Chartkick cummulative user graph

余生长醉 提交于 2019-12-02 09:28:29
问题 I'm using chartkick in an active admin dashboard and trying to track a cumulative user base over time. Using groupdate to count by week I can successfully create a chart displaying point in time counts but struggling to display cumulative results. Any suggestion on best way to approach as I have not found a similar question? chart partial <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %> <%= line_chart User.group_by_week(:created_at).count %> dashboard.rb column do

Rails: Chartkick cummulative user graph

半腔热情 提交于 2019-12-02 04:25:15
I'm using chartkick in an active admin dashboard and trying to track a cumulative user base over time. Using groupdate to count by week I can successfully create a chart displaying point in time counts but struggling to display cumulative results. Any suggestion on best way to approach as I have not found a similar question? chart partial <%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %> <%= line_chart User.group_by_week(:created_at).count %> dashboard.rb column do panel "Recent User Additions" do table_for User.order("id desc").limit(10).each do |_user| column(:email) {