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 7031215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:46:25+00:00 2026-05-28T00:46:25+00:00

Needing some guidance about how to properly graph data that is very small and

  • 0

Needing some guidance about how to properly graph data that is very small and stored as BigDecimal.

If anyone has had experience using BigDecimals in any graphing scenario I believe your input on how you placed these into a usable sequence would be invaluable.

Presently I’m using lazy_high_charts and it really seems that this is going to work out exceptionally well, however I’ve run into a hitch where I’ve not dealt with data on the minute BigDecimal scale hitherto.

Given my queries, I’ll be pulling out about a 1,000 data points for a few different series of data ranging in accuracy from about 0.100E-9 to about 0.100E-1.

What would be the best way to prep these data series for presentation in such a graph that has a scientific application and therefore precision is important? I’m not sure if I could or should continue in BigDecimal or something else?


I’m presently querying the database with a line similar to:

series_a = dataset.order("date").select('data_set.data1').limit(1000).all.zip

I’d appreciate some guidance of going from this result (again, the output is an array of BigDecimals) to the appropriate format for what will go into the chart series.

An contextual example of the code I’m using to build the chart in my controller is:

@h = LazyHighCharts::HighChart.new('graph') do |f|
  series_a = dataset.order("date").select('data_set.data1').limit(1000).all.zip
  series_b = dataset.order("date").select('data_set.data3').limit(1000).all.zip

  f.series(:name => 'Data 1', :data => series_a)
  f.series(:name => 'Data 2', :data => series_b)

  f.chart({:defaultSeriesType => "line" })
  f.yAxis [
        {:title => { :text => "Left Y Label", :margin => 10} },
        {:title => { :text => "Right Y Label"}, :opposite => true }
  ]
  f.xAxis(:title => { :text => "X Label"} )
  f.title(:text => "Graph Title")
  f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical')
end

I think I’m a bit further along in my understanding of this having decided to convert the BigDecimals to strings as per “How to access fields by attribute name from ActiveRecord row results?” However it appears ultimately this fails and gives erratic results as the series functions :data field expects, I think, numeric input. I am thinking that this ultimately emits json to highcharts, however I’m still stuck for the moment in my attempt to pass these values on in correctly.

  • 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-05-28T00:46:26+00:00Added an answer on May 28, 2026 at 12:46 am

    When you do this:

    series_a = dataset.order("date").select('data_set.data1').limit(1000).all.zip
    

    you’ll end up with an array of arrays as we already discussed elsewhere. If you get rid of the zip, you should end up with an array of objects in series_a. I’d guess that chart would be happier with an array of numbers so:

    series_a = dataset.order("date").
                       select('data_set.data1').
                       limit(1000).
                       all.
                       map(&:data1)
    

    or, if data1 is a BigDecimal (due to using a fixed precision type in the database) then maybe you’d want this:

    series_a = dataset.order("date").
                       select('data_set.data1').
                       limit(1000).
                       all.
                       map { |o| o.data1.to_f }
    

    to get an array of floating point values that the chart should know what to do with.

    I’m not familiar with Highcharts so there is some guesswork here.

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

Sidebar

Related Questions

I'm faced with needing access for reporting to some data that lives in Oracle
I'm needing to cache some data using System.Web.Caching.Cache . Not sure if it matters,
I'm needing to troubleshoot some old VB6 code and I'm confused about the use
I am needing to log some xml data (which is currently a JDOM Document),
I am needing to write some code that I can compile and run on
While working on a small project I found myself needing to do some custom
In a desktop application needing some serious re-factoring, I have several chunks of code
I am needing some information on including files in PHP classes. E.G. include Foo2.php;
I am needing to transfer some logs which were timestamped in ticks to an
I am struggling alot with some PHP I am needing to implement a next

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.