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

  • Home
  • SEARCH
  • 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 7783223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:46:26+00:00 2026-06-01T19:46:26+00:00

I am using flot to do some graphing and I am having some trouble

  • 0

I am using flot to do some graphing and I am having some trouble passing the tickSize with my json. I am using MVC and pass the json in a model. Here is some code to grab the json within my javascript function:

var json = '<%=Model.Json %>';
var data = jQuery.parseJSON(json);

Here is how the Json looks leaving the controller:

{\"GraphData\":[{\"X\":1333929600000,\"Y\":0.0},{\"X\":1333670400000,\"Y\":0.46}],\"Max\":1333324800000,\"Min\":1333929600000,\"TickSize\":\"[1, 'day']\"}

The part that I am having trouble with is “TickSize.” As you can see, “[1, ‘day’]” has the square brackets. I think there is some parsing problem because [] usually means an array. Flot wants the tick size in this format. How do I construct my Json so I can grab the TickSize?

  • 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-01T19:46:27+00:00Added an answer on June 1, 2026 at 7:46 pm

    The issue is the single-quotes in the string value, since you’re trying to wrap the JSON string in them as well. The resulting JavaScript will be (truncated):

    var json = '...,\"TickSize\":\"[1, 'day']\"}';
    

    Because of the now 4-count of single-quotes, day isn’t actually part of the string and creates a syntax error.

    But, you shouldn’t even need to quote and parse the JSON since it’s derived from JavaScript syntax:

    var data = <%= Model.Json %>;
    

    If you need the string representation, you can either stringify it in JavaScript:

    var json = JSON.stringify(data):
    

    Or escape single-quotes within the string server-side:

    var json = '<%= Model.Json.Replace("'", "\\'") %>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using flot to do some graphing and I am trying to animate
I am using Flot to create graphs. This is my Code here jsFiddle code
I am using flot to generate bar graphs. Here is my code bar graph
I'm using the Flot graphing library jQuery plugin and I haven't found a good
All, I am using the Flot graphing library in my rails application. I currently
I am using Flot to chart some data that I pull back from the
I'm running the code below and getting an empty chart using Flot/jQuery. Ideally what
I am using Flot for graphing. I put this chart in a div, and
I have a bar chart created using flot jsFiddle Code Now i need to
I am having problem with flot library to plot a graph using its line

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.