Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8946585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:33:30+00:00 2026-06-15T12:33:30+00:00

I want to include my working d3.js code to my Rails app. In my

  • 0

I want to include my working d3.js code to my Rails app. In my view for builds I’m using paginating because there are about 30000 lines. I want to visualize them with d3.js.

It is working for the first 100 lines when I just call a json-object via the model name:

<%= javascript_tag do %>
d3.json('builds', 
            function(data){
                //working function code..
            });     
<% end %>

But the json-object builds takes everytime the first 100 items independent from the paginating. That means builds has all data but it just takes the first 100 because I say in builds model self.per_page = 100 that I can use that for my paginating.

I also tried to create a json-object in the view that just has the current build-objects:

var myJson = <%=raw @builds.to_json %>;

But the problem here is that I can’t give the d3.json function a variable name.

Does anyone know how I can create a json object that I can use for my d3 code that is depending on the current page?

I hope it is clear what I mean otherwise please ask!
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:33:32+00:00Added an answer on June 15, 2026 at 12:33 pm

    Ok, after trying everything I found out how this works:

    d3.json('<% @builds.to_json %>', 
                function(data){
              //code
    

    You cannot create a variable and pass it into the d3.json function but you have to let it evaluate the ruby code by itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to start using Bing for a project which will include working out
I'm working on a small website and I want to include the Asp.Net Membership
I want to include VC 8.0 runtime redistributable packages into my app installer. What
There's a really obvious refactoring opportunity in this (working) code. bool Translations::compatibleNICodes(const Rule& rule,
I have a Ruby on Rails app that I'm working on and I'm having
I have this working code: /* Include files */ #include <iostream> #include <string> #include
I'm using Rails and want to implement FlipCounter. Here is link to documentation -
I have some code (that is working), but I just want to make sure
I'm trying Lua and want to know how lua_State working code and result: state.c
I want to include Javascript code in a HTMLPanel element, but it is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.