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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:00:28+00:00 2026-06-11T06:00:28+00:00

Below is the code that I now have. This gives me a 2 dimensional

  • 0

Below is the code that I now have. This gives me a 2 dimensional array (array of arrays) of the data I need which is perfect, because from what I can tell that’s the best way to do what I am looking for with Highstock.

I think the last step I have to do is get it into the proper format for highstock: Date.UTC(2012, 9, 12)

I want it to look like this: http://jsfiddle.net/DkgVr/4/

Any idea how I can get the date to be like that?

The array right now looks like this: [[Thu, 13 Sep 2012, 215.0], [Wed, 12 Sep 2012, 211.0]]

Users Controller

@weight_items = Weight.order("date DESC").select('weights.content,  weights.date').all

Highstock

<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
    window.chart = new Highcharts.StockChart({
        chart: {
            renderTo: 'weight_chart',
            type: 'line',
            marginRight: 20,
            marginBottom: 25
        },
        title: {
            text: 'Your Weight Over Time',
            x: -20 //center
        },
        yAxis: {
            title: {
                text: 'Weight'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },

        legend: {
            layout: 'vertical',
            align: 'center',
            verticalAlign: 'bottom',
            x: -10,
            y: 100,
            borderWidth: 0
        },

        scrollbar: {
          enabled: true
        },

        rangeSelector : {
            selected : 1
        },

        credits: {
            enabled: false
        },


        series: [{
            tickInterval: <%= 1.day * 1000 %>,
            pointStart: <%= 3.weeks.ago.at_midnight.to_i * 1000 %>,
            name: 'Weight',
            data: <%= weight_and_date_array = @weight_items.map{|row| [row.date.to_date, row.content.to_f] } %>

        }]
    }, 

    function(chart){

        // apply the date pickers
        setTimeout(function(){
            $('input.highcharts-range-selector', $('#'+chart.options.chart.renderTo))
                .datepicker()
        },0)


      });
  });

});
</script>
  • 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-11T06:00:29+00:00Added an answer on June 11, 2026 at 6:00 am

    You don’t need

    xAxis: {
                type: 'datetime'
           }
    

    For HighStock. Also

    {
        pointInterval: <%= 1.day * 1000 %>,
        pointStart: <%= 3.weeks.ago.at_midnight.to_i * 1000 %>,
        name: 'Weight',
        data: <%= Weight.pluck(:content).reverse %>
    }
    

    not required for Highstock. Keep name and data only.

    Interval can be specified using tickInterval in the X Axis options.

    EDIT:
    After your edit, It seems that you are having problem in adding date in HighStock compliant format.

    So, Add dates in UTC. Convert dates into UTC using Ruby, HighStock library will pickit automatically.

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

Sidebar

Related Questions

Edit: original question below, but I revise it now that I have some code
I have this javascript code below that uses jquery, it is suppoed to be
i have php function that parses a xml url and gives me an array.this
I have code that looks more or less like the code below but it
Below is the code that I'm using in ms access to list the data
I have the code below that hides and shows the navigational bar. It is
I have a piece of code (below) that can get the text of an
Background: I have a WPF UserControl (MainControl - not shown in code below) that
Let us say we have some code that looks like below: @interface SomeClass :
i have a listview that shows diferent data from my database. this works perfeclty.

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.