I am using highchart with codeigniter. My json data is like below,
[{"name":"zreadactivity","data":["E-Juice","Tank Kit & Accessories","Clearomizers","Cartomisers & Accessories","Starter Kits"]},{"name":"TotalValue","data":["11,320.00","6,629.52","5,184.43","2,691.75",353.85]}]
Data is coming but spline graph is not created. Only last value is showing in graph that is 353.85, others are not displaying.
Is there any thing for higher value? or where I stuck?
In data you should have array of points with number values, not strings as you have. So you need to convert your json to correct form, during preprocessing or return json in correct form.
Related
I have this solution that helps me creating a Wizard to fill some data and turn into JSON, the problem now is that I have to receive a xlsx and turn specific data from it into JSON, not all the data but only the ones I want which are documented in the last link.
In this link: https://stackblitz.com/edit/xlsx-to-json I can access the excel data and turn into object (when I print document.getElementById('output').innerHTML = JSON.parse(dataString); it shows [object Object])
I want to implement this solution and automatically get the specified fields in the config.ts but can't get to work. For now, I have these in my HTML and app-component.ts
https://stackblitz.com/edit/angular-xbsxd9 (It's probably not compiling but it's to show the code only)
It wasn't quite clear what you were asking, but based on the assumption that what you are trying to do is:
Given the data in the spreadsheet that is uploaded
Use a config that holds the list of column names you want returned in the JSON when the user clicks to download
based on this, I've created a fork of your sample here -> Forked Stackbliz
what I've done is:
use the map operator on the array returned from the sheet_to_json method
Within the map, the process is looping through each key of the record (each key being a column in this case).
If a column in the row is defined in the propertymap file (config), then return it.
This approach strips out all columns you don't care about up front. so that by the time the user clicks to download the file, only the columns you want are returned. If you need to maintain the original columns, then you can move this logic somewhere more convenient for you.
I also augmented the property map a little to give you more granular control over how to format the data in the returned JSON. i.e. don't treat numbers as strings in the final output. you can use this as a template if it suites your needs for any additional formatting.
hope it helps.
I was trying to load data from Google's json export, but it looks like it's not valid JSON (ECMA-404),(RFC 7159),(RFC 4627). Here is what I'm expecting for json newline:
[{},{},{}]
But here is what it's giving:
{}{}{}
Here's an example output from clicking the "Download as JSON" button on a four-row query result:
{"c0":"001U0000016lf5jIAA","c1":"Tim Burton's Corpse Bride","c2":"a0KU000000OkQ8IMAV","c3":"Luxembourg","c4":"German","c5":"Sub & Audio","c21":null,"c22":"2025542.0"}
{"c0":"001U0000016lf5jIAA","c1":"Tim Burton's Corpse Bride","c2":"a0KU000000OkQ8IMAV","c3":"Luxembourg","c4":"German","c5":"Sub & Audio","c21":null,"c22":"2025542.0"}
{"c0":"001U0000016lf5jIAA","c1":"Tim Burton's Corpse Bride","c2":"a0KU000000OjUuEMAV","c3":"Luxembourg","c4":"French - Parisian","c5":"Sub & Audio","c21":null,"c22":"2025542.0"}
{"c0":"001U0000016lf5jIAA","c1":"Tim Burton's Corpse Bride","c2":"a0KU000000OkQ8IMAV","c3":"Luxembourg","c4":"German","c5":"Sub & Audio","c21":null,"c22":"2025542.0"}
Is there a reason why BigQuery is using this export format for json? Are there other Google services or something that are dependent on this format, or why would it be pushing a non-standard json format? (Maybe I'm just misunderstanding json line format). Note, this is from the web-UI, not the API, which gives valid json.
BigQuery reads and outputs new-line delimited JSON - this because traditional JSON doesn't adapt well to the needs of big data.
See:
http://specs.okfnlabs.org/ndjson/
https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON
The output of "Download as JSON" shown in the question is compatible with the JSON input that BigQuery can read.
Note that the web UI also offers to look at the results of a query as JSON - and those results are formatted as a traditional JSON object. I'm not sure what was the design decision to have this incompatible output here - but results in that form won't be able to be imported back to BigQuery.
So in general, this format is incompatible with BigQuery:
While this is compatible with BigQuery:
Why is this less traditional JSON format the best choice in the big data world? Encapsulating a trillion rows within [...] defines a single object with a trillion rows - which is hard to parse and handle. New line delimited JSON solves this problem, with each row being an independent object.
I'm working on some Python code for my local billiard hall and I'm running into problems with JSON encoding. When I dump my data into a file I obviously get all the data in a single line. However, I want my data to be dumped into the file following the format that I want. For example (Had to do picture to get point across),
My custom JSON format
. I've looked up questions on custom JSONEncoders but it seems they all have to do with datatypes that aren't JSON serializable. I never found a solution for my specific need which is having everything laid out in the manner that I want. Basically, I want all of the list elements to on a separate row but all of the dict items to be in the same row. Do I need to write my own custom encoder or is there some other approach I need to take? Thanks!
I want to create and format a json object in R(from a dataframe).
Output Format --
{"base":{K1:V1,K2:V2},"Criteria":{C1:v1,C2:v2}}
Code I'm using currently --
K1=c("V1")
K2=c("V2")
dataframe1=data.frame(K1,K2)
C1=c("v1")
C2=c("v2")
dataframe2=data.frame(C1,C2)
toJSON(list(base=dataframe1,Criteria=dataframe2))
Current Output --
{"base":[{"K1":"V1","K2":"V2"}],"Criteria":[{"C1":"v1","C2":"v2"}]}
I basically want to get rid of the square brackets "[]" . This output goes into an API which doesn't accept lists as a part of values in the JSON. Any direction is appreciated!
P.S: I have unsuccessfully looked for related threads on Stackoverflow.
I am trying to understand the demo at http://www.highcharts.com/demo/line-ajax which plots data using a csv file fetched through an ajax call.
Highcharts appears to assume that first column is X axis, with subsequent columns being Y axes data with the same units. The series part in the provided jsfiddle can be completely removed and example still runs the same, so I believe its not being used when data csv property is set. I was also unable to find any explanation of the csv property in Highcharts API docs.
Note: This example is using a different approach from other csv documentation on the site.
The csv format allowed does not seem to support double quotes. Also, I can get data with 2 columns to render, but I was wondering if there is any way to tell Highcharts to use 2 particular columns for X & Y axes while ignoring other columns in the input csv.
Is there a good reference to configuration settings available when using data csv property as in the given example?
Is there any example of a composite chart with spline & scatter plots created dynamically from csv data fetched thru ajax?
Docs for data.js plugin is described inside the data.js file.
And demo for spline and scatter: http://jsfiddle.net/3qv11owm/
series: [{
type: 'scatter'
}, {
type: 'spline'
}]
Options from series array are merged with series from CSV.