amcharts / dataloader Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
I just ran into an issue where Firefox wouldn't load any json graphs whereas Chrome would. It seems that Firefox sets a very specific accept header
text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
that sets other accepted formats whereas chrome sets it as / . The particular service I'm pulling data from can return xml or json depending on the accept headers and was choosing to return xml since the default header includes it.
It seems to me that a sensible default would be to set application/json or text/csv based on what is specified in the dataLoader section with the option to override the defaults through the use of the headers array which is what I used to fix this problem.
Also, the fact that you can specify the accept headers is not specified on this page
http://www.amcharts.com/tutorials/using-data-loader-plugin/
If dataloader is included twice, the complete callback will fire only once.
http://jsfiddle.net/duebhfm0/3/ (watch console log)
I think it'd be really useful to be able to call onload for only one of the dataSet indexes instead of reloading them all. Similar to #9.
Simply enhancing loadData to take an argument which only loads that index would be enough. The current problem with loadData is it reloads all remote sources.
A use case of this is if you have a dataSetSelector and large number of remote dataSets, onload automatically calls when the chart is rendered, this causes all of these URL's to be requested and their graphs to be rendered. To support a use case where these are only load on select or compare (using a the dataSetSelector listener) would allow for the remote sources to be requested on change and not all once.
Something like:
{
dataSets: [
{
id: 1,
dataLoader: {}
},
{
id: 2,
dataLoader: {}
}
]
}
chart.dataSetSelector.addListener("dataSetSelected", function(event) {
dataSet = event.dataSet
if (dataSet.dataProvider.length)
return;
dataSet.dataLoader = {url: '/path/to/json/" + dataSet.id) }
chart.dataLoader.loadData(dataSet.id); // Takes ID or dataSet index
chart.validateData();
});
If I'm added to html: <script type="text/javascript" src="/js/amcharts/plugins/dataloader/lang/en.js"></script>
Set graph option: "language" : "en"
And this give me error: Uncaught TypeError: Cannot set property 'en' of undefined
Chrome 41 linux
When using the dataLoader to initialize a map, the above JS error loops until the data is loaded. I'm suspecting this is much like #5.
Need function/method for change data url and (or) function for reload new data by url.
Maybe with new "url" param: chart.dataloader.reload/reloadUrl(url)
Hi
I am working on amchart world map plugin. Our data load every 5 mins and we are using map.validateData(); .
But when its refresh the data its also reload the complete world map.
Let me know how can i refresh data without reloading map.
Error callback only working if 404 status sent https://github.com/amcharts/dataloader/blob/master/dataloader.js#L477
Maybe the right way is to use 200 and 302 HTTP codes for success and others for failure?
Also if there is no data from response amcharts just throws an error. It will be good if error function will be called here.
"listeners": [{ "event": "init", "method": function(e) { e.chart.zoomToIndex(e.chart.dataLoader.length - 70, e.chart.dataLoader.length - 1); } }],
The code above does not work on AmCharts Serial with dataLoader.
Can anyone help?
Hi there,
I am using AmCharts 3.
I can not use chart.dataLoader.loadData().
I initialize the instance like following.
var charts = [];
charts[charts.length] = AmCharts.makeChart();
charts[0].dataLoader.loadData().
Is this wrong way to use?
So I have a page that loads the page the chart displays on via Ajax, it works fine, the dataLoader does it's job, but I notice if I load another page after that with another dataLoader, it now adds another ajax call, so if I look at 5 different charts, by the time I look at the 5th chart it has 5 unique ajax requests being made by the dataLoader, is there something that can be done to fix this?
I give at data not json content, and after complete (after msg Loading data...
) show me onlu empty graph without errors, msgs.
Not work error msg: Error parsing JSON file
With data with a date format "YYYY-MM-DD" and no dateFormat set within periodSelector, I'm getting this error, although the graph renders as expected:
Uncaught TypeError: Cannot read property 'setDefaultPeriod' of undefined
Fiddle: http://jsfiddle.net/6g6tcbb1/1/
When the dateFormat is set, the graph size is shrunk and no longer visible: http://jsfiddle.net/6g6tcbb1/2/
I'm guessing the periodSelector isn't waiting until the data has been fully loaded but it's hard to dig through the minified amcharts files.
When you have the map and chart files both included in a document the "loading" curtain doesn't consistently show.
With map: http://jsfiddle.net/6g6tcbb1/3/
Without map: http://jsfiddle.net/6g6tcbb1/4/
try every possible way i could think of to load Lang Translation since there's no examples shown how to use it but none are working.
I try to use Zoomtoindex for my charts.
I use dataloader with some json data.
I want to do something like this :
zoomToIndex(chart.daraLoader.length -90 , chart.daraLoader.length -1);
But it doesn't work ... how can I have the length of the json data loaded with dataloader ?
Thanks
I have searched high and low for a solution and have found many people asking this question but no answer. I am trying to alter this example to work with external data: https://www.amcharts.com/kbase/making-stock-charts-period-selector-input-fields-read-only/
Is it possible to load data from multiple CSVs into an array and then apply each set to a chart dataset??
Thanks!
Something like this...
var dataSets = [];
var files = ['1.csv', '2.csv', '3.csv', '4.csv'];
for(var fileid in files) {
AmCharts.loadFile(fileid, {}, function( response ) {
/**
* Parse CSV
*/
var data = AmCharts.parseCSV( response, {
"useColumnNames": true
} );
dataSets.push(data);
});
}
.................................
(Not sure whether to use "dataLoader" or "dataProvider")
.................................
var chart = AmCharts.makeChart("chartdiv", {
type: "stock",
"theme": "none",
//"dataProvider": dataSets,
pathToImages: "https://www.amcharts.com/lib/3/images/",
dataSets: [{
title: "first data set",
fieldMappings: [{
fromField: "value",
toField: "value"
}, {
fromField: "rank",
toField: "rank"
}],
dataLoader: dataSets[0],
categoryField: "date"
},
{
title: "second data set",
fieldMappings: [{
fromField: "value",
toField: "value"
}, {
fromField: "rank",
toField: "rank"
}],
dataLoader: dataSets[1],
categoryField: "date"
},
{
title: "third data set",
fieldMappings: [{
fromField: "value",
toField: "value"
}, {
fromField: "rank",
toField: "rank"
}],
dataLoader: dataSets[2],
categoryField: "date"
},
{
title: "fourth data set",
fieldMappings: [{
fromField: "value",
toField: "value"
}, {
fromField: "rank",
toField: "rank"
}],
dataLoader: dataSets[3],
categoryField: "date"
}
],
Need callback option: onComplete
Need allow in postProcess callback return error and show error message (maybe custom error msg?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.