TanTayBui / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Json Format questions #717

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Why the flot json format is like this

[["0", "-2.13"], ["5", "4.3"]]

and most of the common knowledge format is :

[{"0": "-2.13"}, {"5": "4.3"}]

Please look at this: http://json.org/example.html

Original issue reported on code.google.com by yhj...@gmail.com on 10 Jul 2012 at 6:54

GoogleCodeExporter commented 9 years ago
It's actually far more standard to represent series values as an array than as 
an object, especially once you go beyond two values, as with candlestick plots 
and such.

I've used a lot of plotting libraries, and have never seen objects used to 
represent points.

Original comment by dnsch...@gmail.com on 10 Jul 2012 at 11:25

GoogleCodeExporter commented 9 years ago
Hi dnsch

What do you mean that? I can not understand your post

Original comment by yhj...@gmail.com on 11 Jul 2012 at 1:35

GoogleCodeExporter commented 9 years ago
The array format - [x, y] - is actually much more common when it comes to this 
kind of data; I've never seen objects - {x: y} - used in this context.

My other point is that not all chart types use only [x, y]; a horizontal 
candlestick chart, for example, uses [x1, x2, x3, x4, y].  In that case the 
object representation no longer works.

Original comment by dnsch...@gmail.com on 11 Jul 2012 at 1:49

GoogleCodeExporter commented 9 years ago
Did you read the URL which I sent to you.

http://json.org/example.html
http://api.jquery.com/jQuery.parseJSON/

It's my first time to people use the format like [x, y]

Original comment by yhj...@gmail.com on 11 Jul 2012 at 1:58

GoogleCodeExporter commented 9 years ago
I know what JSON is; I've been using it for many years.  Arrays are the correct 
format for this kind of data.

Original comment by dnsch...@gmail.com on 11 Jul 2012 at 2:09

GoogleCodeExporter commented 9 years ago
I don't want to offend you, but this flot json is different with the standard. 
You do a search on stackflow, there are other people are asking this kind of 
questions.

Original comment by yhj...@gmail.com on 11 Jul 2012 at 2:30

GoogleCodeExporter commented 9 years ago
No, it's really not.  You're clearly new to JSON, but if you spend a little 
more time reading outside that example page you'll realize that arrays are very 
much part of the standard, and everyone uses them.  Take a look at 
http://www.json.org; they are described many times, starting from the very top 
of the page.

Flot's use of arrays is correct, and matches the behavior of a great number of 
other charting and plotting libraries.  This issue is closed, and will not get 
any further response.

Original comment by dnsch...@gmail.com on 11 Jul 2012 at 2:49