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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:48:09+00:00 2026-06-14T03:48:09+00:00

I am working with JqPlot with ASP.NET MVC 4. This is a sample data

  • 0

I am working with JqPlot with ASP.NET MVC 4.

This is a sample data from one of the examples from Jqplot

var line1 = [['2008-06-30 8:00AM', 4], ['2008-7-30 8:00AM', 6.5], ['2008-8-30 8:00AM', 5.7], ['2008-9-30 8:00AM', 9], ['2008-10-30 8:00AM', 8.2]];

the first value in the pair is DateTime and other is value.

Now I am trying to get value like this from controller instead, I am using Web Api Controller

my action is as follows

public List<Stats> GetGraphData()
{
    var stats = new List<Stats>
                    {
                        new Stats {Date = DateTime.Now, Value = 4},
                        new Stats {Date = DateTime.Now.AddMonths(1), Value = 11},
                        new Stats {Date = DateTime.Now.AddMonths(2), Value = 5},
                        new Stats {Date = DateTime.Now.AddMonths(3), Value = 7},
                    };
    return stats;
}

but the value that returned is

[Object { Date= “2012-11-08T16:52:04.5047592+05:30″, Value=4}, [Object { Date=”2012-11-08T16:52:04.5047592+05:30”, Value=4}, …

So I decided to try JSON.stringify() on it which gave the following…

[{“Date”:”2012-11-08T16:52:04.5047592+05:30″,”Value”:4},{“Date”:”2012-12-08T16:52:04.5047592+05:30″,”Value”:11},{“Date”:”2013-01-08T16:52:04.5047592+05:30″,”Value”:5},{“Date”:”2013-02-08T16:52:04.5047592+05:30″,”Value”:7}]

How do I get the format like the one shown below ?
[['2008-06-30 8:00AM', 4], ['2008-7-30 8:00AM', 6.5], ['2008-8-30 8:00AM', 5.7], ['2008-9-30 8:00AM', 9], ['2008-10-30 8:00AM', 8.2]];

Please help me on this.

Note : Please feel free to edit the Title of my question, I could’nt think of anything else 😛

  • 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-14T03:48:10+00:00Added an answer on June 14, 2026 at 3:48 am

    This is because you are using objects instead of arrays, you can do something like this: instead of this:

    new Stats {Date = DateTime.Now, Value = 4},
    

    Try this:

    new String[] { DateTime.Now.ToString(), "4" },
    

    Of course change the List<Stats> to List<String[]>

    Another option would be to flatten the object into an array in Javascript once you get it. Let’s say you put the data coming form the server into a variable called serverArray, this will look like an array of objects:

    var serverArray = [{Date: "2012-11-08T16:52:04.5047592+05:30", Value: 4}, { .... }, etc. etc. ];
    

    Then you can use .map() to map this array into another array:

    results = serverArray.map(function (obj) { return [obj.Date, obj.Value]; });
    

    results will look like this (note the squqre brackets to indicate an array and the absence of the object keys, Date and Value):

    [["2012-11-08T16:52:04.5047592+05:30", 4], [......], etc. etc. ];
    

    and then you can use “results” in you plotting being in the same format as the sample data.

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

Sidebar

Related Questions

Working sample using one Table SELECT t.* FROM ( SELECT TITLE.name, (TITLE.value-TITLE.msp) AS Lower,
i am working on thr Chart with Point Labels inside my asp.net mvc as
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
Working with H2 I get this error when I try to write a row
Working on game where plates will be falling from top to bottom. Some plates
The first script is not working, the second is. <script type=text/javascript> var pageHits =
Working with cakePHP this is my situation: I have Users and Order s. Order
Working example: http://alpha.jsfiddle.net/gTpWv/ Both of the methods work separately, but once regexp for smilies
Working with Json, how can I NSlog only the title in this code: NSDictionary

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.