mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
28
web/js/amcharts/plugins/dataloader/bower.json
Normal file
28
web/js/amcharts/plugins/dataloader/bower.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "amcharts3-dataloader",
|
||||
"authors": [
|
||||
"amCharts <contact@amcharts.com>"
|
||||
],
|
||||
"description": "amCharts V3 Data Loader plugin",
|
||||
"main": [
|
||||
"dataloader.js"
|
||||
],
|
||||
"keywords": [
|
||||
"amcharts",
|
||||
"charts",
|
||||
"javascript",
|
||||
"plugin"
|
||||
],
|
||||
"moduleType": [
|
||||
"globals"
|
||||
],
|
||||
"dependencies": {
|
||||
"amcharts3": ">= 3.11.1"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "https://www.amcharts.com/",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/amcharts/dataloader.git"
|
||||
}
|
||||
}
|
744
web/js/amcharts/plugins/dataloader/dataloader.js
Normal file
744
web/js/amcharts/plugins/dataloader/dataloader.js
Normal file
|
@ -0,0 +1,744 @@
|
|||
/*
|
||||
Plugin Name: amCharts Data Loader
|
||||
Description: This plugin adds external data loading capabilities to all amCharts libraries.
|
||||
Author: Martynas Majeris, amCharts
|
||||
Version: 1.0.16
|
||||
Author URI: http://www.amcharts.com/
|
||||
|
||||
Copyright 2015 amCharts
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Please note that the above license covers only this plugin. It by all means does
|
||||
not apply to any other amCharts products that are covered by different licenses.
|
||||
*/
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* incremental load
|
||||
* XML support (?)
|
||||
*/
|
||||
|
||||
/* globals AmCharts, ActiveXObject */
|
||||
/* jshint -W061 */
|
||||
|
||||
/**
|
||||
* Initialize language prompt container
|
||||
*/
|
||||
AmCharts.translations.dataLoader = {};
|
||||
|
||||
/**
|
||||
* Set init handler
|
||||
*/
|
||||
AmCharts.addInitHandler( function( chart ) {
|
||||
|
||||
/**
|
||||
* Check if dataLoader is set (initialize it)
|
||||
*/
|
||||
if ( undefined === chart.dataLoader || !isObject( chart.dataLoader ) )
|
||||
chart.dataLoader = {};
|
||||
|
||||
/**
|
||||
* Check charts version for compatibility:
|
||||
* the first compatible version is 3.13
|
||||
*/
|
||||
var version = chart.version.split( '.' );
|
||||
if ( ( Number( version[ 0 ] ) < 3 ) || ( 3 === Number( version[ 0 ] ) && ( Number( version[ 1 ] ) < 13 ) ) )
|
||||
return;
|
||||
|
||||
/**
|
||||
* Define object reference for easy access
|
||||
*/
|
||||
var l = chart.dataLoader;
|
||||
l.remaining = 0;
|
||||
l.percentLoaded = {};
|
||||
|
||||
/**
|
||||
* Set defaults
|
||||
*/
|
||||
var defaults = {
|
||||
'async': true,
|
||||
'format': 'json',
|
||||
'showErrors': true,
|
||||
'showCurtain': true,
|
||||
'noStyles': false,
|
||||
'reload': 0,
|
||||
'timestamp': false,
|
||||
'delimiter': ',',
|
||||
'skip': 0,
|
||||
'skipEmpty': true,
|
||||
'emptyAs': undefined,
|
||||
'useColumnNames': false,
|
||||
'init': false,
|
||||
'progress': false,
|
||||
'reverse': false,
|
||||
'reloading': false,
|
||||
'complete': false,
|
||||
'error': false,
|
||||
'numberFields': [],
|
||||
'headers': [],
|
||||
'chart': chart
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a function that can be used to load data (or reload via API)
|
||||
*/
|
||||
l.loadData = function() {
|
||||
|
||||
/**
|
||||
* Load all files in a row
|
||||
*/
|
||||
if ( 'stock' === chart.type ) {
|
||||
|
||||
// delay this a little bit so the chart has the chance to build itself
|
||||
setTimeout( function() {
|
||||
|
||||
// preserve animation
|
||||
if ( 0 > chart.panelsSettings.startDuration ) {
|
||||
l.startDuration = chart.panelsSettings.startDuration;
|
||||
chart.panelsSettings.startDuration = 0;
|
||||
}
|
||||
|
||||
// cycle through all of the data sets
|
||||
for ( var x = 0; x < chart.dataSets.length; x++ ) {
|
||||
var ds = chart.dataSets[ x ];
|
||||
|
||||
// load data
|
||||
if ( undefined !== ds.dataLoader && undefined !== ds.dataLoader.url ) {
|
||||
|
||||
callFunction( ds.dataLoader.init, ds.dataLoader, chart );
|
||||
ds.dataProvider = [];
|
||||
applyDefaults( ds.dataLoader );
|
||||
loadFile( ds.dataLoader.url, ds, ds.dataLoader, 'dataProvider' );
|
||||
|
||||
}
|
||||
|
||||
// load events data
|
||||
if ( undefined !== ds.eventDataLoader && undefined !== ds.eventDataLoader.url ) {
|
||||
|
||||
callFunction( ds.eventDataLoader.init, ds.eventDataLoader, chart );
|
||||
ds.events = [];
|
||||
applyDefaults( ds.eventDataLoader );
|
||||
loadFile( ds.eventDataLoader.url, ds, ds.eventDataLoader, 'stockEvents' );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}, 100 );
|
||||
|
||||
} else {
|
||||
|
||||
callFunction( l.init, l, chart );
|
||||
|
||||
applyDefaults( l );
|
||||
|
||||
if ( undefined === l.url )
|
||||
return;
|
||||
|
||||
// preserve animation
|
||||
if ( undefined !== chart.startDuration && ( 0 < chart.startDuration ) ) {
|
||||
l.startDuration = chart.startDuration;
|
||||
chart.startDuration = 0;
|
||||
}
|
||||
|
||||
if ( 'gauge' === chart.type ) {
|
||||
// set empty data set
|
||||
if ( undefined === chart.arrows )
|
||||
chart.arrows = [];
|
||||
|
||||
loadFile( l.url, chart, l, 'arrows' );
|
||||
} else {
|
||||
// set empty data set
|
||||
if ( undefined === chart.dataProvider )
|
||||
chart.dataProvider = chart.type === 'map' ? {} : [];
|
||||
|
||||
loadFile( l.url, chart, l, 'dataProvider' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger load
|
||||
*/
|
||||
l.loadData();
|
||||
|
||||
/**
|
||||
* Loads a file and determines correct parsing mechanism for it
|
||||
*/
|
||||
function loadFile( url, holder, options, providerKey ) {
|
||||
|
||||
// set default providerKey
|
||||
if ( undefined === providerKey )
|
||||
providerKey = 'dataProvider';
|
||||
|
||||
// show curtain
|
||||
if ( options.showCurtain )
|
||||
showCurtain( undefined, options.noStyles );
|
||||
|
||||
// increment loader count
|
||||
l.remaining++;
|
||||
|
||||
// set percent loaded for this file
|
||||
l.percentLoaded[ url ] = 0;
|
||||
|
||||
// hijack user-defined "progress" handler with our own, so that we can
|
||||
// track progress
|
||||
if ( options.progress !== undefined && typeof( options.progress ) === 'function' && options._progress === undefined ) {
|
||||
options._progress = options.progress;
|
||||
options.progress = function( percent ) {
|
||||
// set progress
|
||||
l.percentLoaded[ url ] = percent;
|
||||
|
||||
// calculate global percent
|
||||
var totalPercent = 0;
|
||||
var fileCount = 0;
|
||||
for ( var x in l.percentLoaded ) {
|
||||
if ( l.percentLoaded.hasOwnProperty( x ) ) {
|
||||
fileCount++;
|
||||
totalPercent += l.percentLoaded[ x ];
|
||||
}
|
||||
}
|
||||
var globalPercent = Math.round( ( totalPercent / fileCount ) * 100 ) / 100;
|
||||
|
||||
// call user function
|
||||
options._progress.call( this, globalPercent, Math.round( percent * 100 ) / 100, url );
|
||||
};
|
||||
}
|
||||
|
||||
// load the file
|
||||
AmCharts.loadFile( url, options, function( response ) {
|
||||
|
||||
// error?
|
||||
if ( false === response ) {
|
||||
callFunction( options.error, options, chart );
|
||||
raiseError( AmCharts.__( 'Error loading the file', chart.language ) + ': ' + url, false, options );
|
||||
} else {
|
||||
|
||||
// determine the format
|
||||
if ( undefined === options.format ) {
|
||||
// TODO
|
||||
options.format = 'json';
|
||||
}
|
||||
|
||||
// lowercase
|
||||
options.format = options.format.toLowerCase();
|
||||
|
||||
// invoke parsing function
|
||||
switch ( options.format ) {
|
||||
|
||||
case 'json':
|
||||
|
||||
holder[ providerKey ] = AmCharts.parseJSON( response );
|
||||
|
||||
if ( false === holder[ providerKey ] ) {
|
||||
callFunction( options.error, options, chart );
|
||||
raiseError( AmCharts.__( 'Error parsing JSON file', chart.language ) + ': ' + l.url, false, options );
|
||||
holder[ providerKey ] = [];
|
||||
return;
|
||||
} else {
|
||||
holder[ providerKey ] = postprocess( holder[ providerKey ], options );
|
||||
callFunction( options.load, options, chart );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'csv':
|
||||
|
||||
holder[ providerKey ] = AmCharts.parseCSV( response, options );
|
||||
|
||||
if ( false === holder[ providerKey ] ) {
|
||||
callFunction( options.error, options, chart );
|
||||
raiseError( AmCharts.__( 'Error parsing CSV file', chart.language ) + ': ' + l.url, false, options );
|
||||
holder[ providerKey ] = [];
|
||||
return;
|
||||
} else {
|
||||
holder[ providerKey ] = postprocess( holder[ providerKey ], options );
|
||||
callFunction( options.load, options, chart );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
callFunction( options.error, options, chart );
|
||||
raiseError( AmCharts.__( 'Unsupported data format', chart.language ) + ': ' + options.format, false, options.noStyles );
|
||||
return;
|
||||
}
|
||||
|
||||
// decrement remaining counter
|
||||
l.remaining--;
|
||||
|
||||
// we done?
|
||||
if ( 0 === l.remaining ) {
|
||||
|
||||
// callback
|
||||
callFunction( options.complete, chart );
|
||||
|
||||
// take in the new data
|
||||
if ( options.async ) {
|
||||
|
||||
if ( 'map' === chart.type ) {
|
||||
|
||||
// take in new data
|
||||
chart.validateNow( true );
|
||||
|
||||
// remove curtain
|
||||
removeCurtain();
|
||||
|
||||
} else {
|
||||
|
||||
// add a dataUpdated event to handle post-load stuff
|
||||
if ( 'gauge' !== chart.type ) {
|
||||
chart.addListener( 'dataUpdated', function( event ) {
|
||||
|
||||
// restore default period (stock chart)
|
||||
if ( 'stock' === chart.type && !options.reloading && undefined !== chart.periodSelector ) {
|
||||
chart.periodSelector.setDefaultPeriod();
|
||||
}
|
||||
|
||||
// remove curtain
|
||||
removeCurtain();
|
||||
|
||||
// remove this listener
|
||||
chart.events.dataUpdated.pop();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
// take in new data
|
||||
chart.validateData();
|
||||
|
||||
// invalidate size for the pie chart
|
||||
// disabled for now as it is not longer necessary
|
||||
/*if ( 'pie' === chart.type && chart.invalidateSize !== undefined )
|
||||
chart.invalidateSize();*/
|
||||
|
||||
// gauge chart does not trigger dataUpdated event
|
||||
// let's explicitly remove the curtain for it
|
||||
if ( 'gauge' === chart.type )
|
||||
removeCurtain();
|
||||
|
||||
// make the chart animate again
|
||||
if ( l.startDuration ) {
|
||||
if ( 'stock' === chart.type ) {
|
||||
chart.panelsSettings.startDuration = l.startDuration;
|
||||
for ( var x = 0; x < chart.panels.length; x++ ) {
|
||||
chart.panels[ x ].startDuration = l.startDuration;
|
||||
chart.panels[ x ].animateAgain();
|
||||
}
|
||||
} else {
|
||||
chart.startDuration = l.startDuration;
|
||||
if ( chart.animateAgain !== undefined )
|
||||
chart.animateAgain();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// schedule another load if necessary
|
||||
if ( options.reload ) {
|
||||
|
||||
if ( options.timeout )
|
||||
clearTimeout( options.timeout );
|
||||
|
||||
options.timeout = setTimeout( loadFile, 1000 * options.reload, url, holder, options, providerKey );
|
||||
options.reloading = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if postProcess is set and invokes the handler
|
||||
*/
|
||||
function postprocess( data, options ) {
|
||||
if ( undefined !== options.postProcess && isFunction( options.postProcess ) )
|
||||
try {
|
||||
return options.postProcess.call( l, data, options, chart );
|
||||
} catch ( e ) {
|
||||
raiseError( AmCharts.__( 'Error loading file', chart.language ) + ': ' + options.url, false, options );
|
||||
return data;
|
||||
} else
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if argument is array
|
||||
*/
|
||||
function isObject( obj ) {
|
||||
return 'object' === typeof( obj );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true is argument is a function
|
||||
*/
|
||||
function isFunction( obj ) {
|
||||
return 'function' === typeof( obj );
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies defaults to config object
|
||||
*/
|
||||
function applyDefaults( obj ) {
|
||||
for ( var x in defaults ) {
|
||||
if ( defaults.hasOwnProperty( x ) )
|
||||
setDefault( obj, x, defaults[ x ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if object property is set, sets with a default if it isn't
|
||||
*/
|
||||
function setDefault( obj, key, value ) {
|
||||
if ( undefined === obj[ key ] )
|
||||
obj[ key ] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raises an internal error (writes it out to console)
|
||||
*/
|
||||
function raiseError( msg, error, options ) {
|
||||
|
||||
if ( options.showErrors )
|
||||
showCurtain( msg, options.noStyles );
|
||||
else {
|
||||
removeCurtain();
|
||||
console.log( msg );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows curtain over chart area
|
||||
*/
|
||||
function showCurtain( msg, noStyles ) {
|
||||
|
||||
// remove previous curtain if there is one
|
||||
removeCurtain();
|
||||
|
||||
// did we pass in the message?
|
||||
if ( undefined === msg )
|
||||
msg = AmCharts.__( 'Loading data...', chart.language );
|
||||
|
||||
// create and populate curtain element
|
||||
var curtain = document.createElement( 'div' );
|
||||
curtain.setAttribute( 'id', chart.div.id + '-curtain' );
|
||||
curtain.className = 'amcharts-dataloader-curtain';
|
||||
|
||||
if ( true !== noStyles ) {
|
||||
curtain.style.position = 'absolute';
|
||||
curtain.style.top = 0;
|
||||
curtain.style.left = 0;
|
||||
curtain.style.width = ( undefined !== chart.realWidth ? chart.realWidth : chart.divRealWidth ) + 'px';
|
||||
curtain.style.height = ( undefined !== chart.realHeight ? chart.realHeight : chart.divRealHeight ) + 'px';
|
||||
curtain.style.textAlign = 'center';
|
||||
curtain.style.display = 'table';
|
||||
curtain.style.fontSize = '20px';
|
||||
try {
|
||||
curtain.style.background = 'rgba(255, 255, 255, 0.3)';
|
||||
} catch ( e ) {
|
||||
curtain.style.background = 'rgb(255, 255, 255)';
|
||||
}
|
||||
curtain.innerHTML = '<div style="display: table-cell; vertical-align: middle;">' + msg + '</div>';
|
||||
} else {
|
||||
curtain.innerHTML = msg;
|
||||
}
|
||||
chart.containerDiv.appendChild( curtain );
|
||||
|
||||
l.curtain = curtain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the curtain
|
||||
*/
|
||||
function removeCurtain() {
|
||||
try {
|
||||
if ( undefined !== l.curtain )
|
||||
chart.containerDiv.removeChild( l.curtain );
|
||||
} catch ( e ) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
l.curtain = undefined;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute callback function
|
||||
*/
|
||||
function callFunction( func, param1, param2, param3 ) {
|
||||
if ( 'function' === typeof func )
|
||||
func.call( l, param1, param2, param3 );
|
||||
}
|
||||
|
||||
}, [ 'pie', 'serial', 'xy', 'funnel', 'radar', 'gauge', 'gantt', 'stock', 'map' ] );
|
||||
|
||||
|
||||
/**
|
||||
* Returns prompt in a chart language (set by chart.language) if it is
|
||||
* available
|
||||
*/
|
||||
if ( undefined === AmCharts.__ ) {
|
||||
AmCharts.__ = function( msg, language ) {
|
||||
if ( undefined !== language && undefined !== AmCharts.translations.dataLoader[ language ] && undefined !== AmCharts.translations.dataLoader[ language ][ msg ] )
|
||||
return AmCharts.translations.dataLoader[ language ][ msg ];
|
||||
else
|
||||
return msg;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a file from url and calls function handler with the result
|
||||
*/
|
||||
AmCharts.loadFile = function( url, options, handler ) {
|
||||
|
||||
// prepopulate options with minimal defaults if necessary
|
||||
if ( typeof( options ) !== 'object' )
|
||||
options = {};
|
||||
if ( options.async === undefined )
|
||||
options.async = true;
|
||||
|
||||
// create the request
|
||||
var request;
|
||||
if ( window.XMLHttpRequest ) {
|
||||
// IE7+, Firefox, Chrome, Opera, Safari
|
||||
request = new XMLHttpRequest();
|
||||
} else {
|
||||
// code for IE6, IE5
|
||||
request = new ActiveXObject( 'Microsoft.XMLHTTP' );
|
||||
}
|
||||
|
||||
// open the connection
|
||||
try {
|
||||
request.open( 'GET', options.timestamp ? AmCharts.timestampUrl( url ) : url, options.async );
|
||||
} catch ( e ) {
|
||||
handler.call( this, false );
|
||||
}
|
||||
|
||||
// add headers?
|
||||
if ( options.headers !== undefined && options.headers.length ) {
|
||||
for ( var i = 0; i < options.headers.length; i++ ) {
|
||||
var header = options.headers[ i ];
|
||||
request.setRequestHeader( header.key, header.value );
|
||||
}
|
||||
}
|
||||
|
||||
// add onprogress handlers
|
||||
if ( options.progress !== undefined && typeof( options.progress ) === 'function' ) {
|
||||
request.onprogress = function( e ) {
|
||||
var complete = ( e.loaded / e.total ) * 100;
|
||||
options.progress.call( this, complete );
|
||||
}
|
||||
}
|
||||
|
||||
// set handler for data if async loading
|
||||
request.onreadystatechange = function() {
|
||||
|
||||
if ( 4 === request.readyState && 404 === request.status )
|
||||
handler.call( this, false );
|
||||
|
||||
else if ( 4 === request.readyState && 200 === request.status )
|
||||
handler.call( this, request.responseText );
|
||||
|
||||
};
|
||||
|
||||
// load the file
|
||||
try {
|
||||
request.send();
|
||||
} catch ( e ) {
|
||||
handler.call( this, false );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses JSON string into an object
|
||||
*/
|
||||
AmCharts.parseJSON = function( response ) {
|
||||
try {
|
||||
if ( undefined !== JSON )
|
||||
return JSON.parse( response );
|
||||
else
|
||||
return eval( response );
|
||||
} catch ( e ) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prases CSV string into an object
|
||||
*/
|
||||
AmCharts.parseCSV = function( response, options ) {
|
||||
|
||||
// parse CSV into array
|
||||
var data = AmCharts.CSVToArray( response, options.delimiter );
|
||||
|
||||
// do we need to cast some fields to numbers?
|
||||
var numbers = options.numberFields && ( options.numberFields.length > 0 );
|
||||
|
||||
// init resuling array
|
||||
var res = [];
|
||||
var cols = [];
|
||||
var col, i;
|
||||
|
||||
// first row holds column names?
|
||||
if ( options.useColumnNames ) {
|
||||
cols = data.shift();
|
||||
|
||||
// normalize column names
|
||||
for ( var x = 0; x < cols.length; x++ ) {
|
||||
// trim
|
||||
col = cols[ x ].replace( /^\s+|\s+$/gm, '' );
|
||||
|
||||
// check for empty
|
||||
if ( '' === col )
|
||||
col = 'col' + x;
|
||||
|
||||
cols[ x ] = col;
|
||||
}
|
||||
|
||||
if ( 0 < options.skip )
|
||||
options.skip--;
|
||||
}
|
||||
|
||||
// skip rows
|
||||
for ( i = 0; i < options.skip; i++ )
|
||||
data.shift();
|
||||
|
||||
// iterate through the result set
|
||||
var row;
|
||||
while ( ( row = options.reverse ? data.pop() : data.shift() ) ) {
|
||||
if ( options.skipEmpty && row.length === 1 && row[ 0 ] === '' )
|
||||
continue;
|
||||
var dataPoint = {};
|
||||
for ( i = 0; i < row.length; i++ ) {
|
||||
col = undefined === cols[ i ] ? 'col' + i : cols[ i ];
|
||||
dataPoint[ col ] = row[ i ] === "" ? options.emptyAs : row[ i ];
|
||||
|
||||
// check if we need to cast to integer
|
||||
if ( numbers && options.numberFields.indexOf( col ) !== -1 )
|
||||
dataPoint[ col ] = Number( dataPoint[ col ] );
|
||||
}
|
||||
res.push( dataPoint );
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses CSV data into array
|
||||
* Taken from here: (thanks!)
|
||||
* http://www.bennadel.com/blog/1504-ask-ben-parsing-csv-strings-with-javascript-exec-regular-expression-command.htm
|
||||
*/
|
||||
AmCharts.CSVToArray = function( strData, strDelimiter ) {
|
||||
// Check to see if the delimiter is defined. If not,
|
||||
// then default to comma.
|
||||
strDelimiter = ( strDelimiter || ',' );
|
||||
|
||||
// Create a regular expression to parse the CSV values.
|
||||
var objPattern = new RegExp(
|
||||
(
|
||||
// Delimiters.
|
||||
"(\\" + strDelimiter + "|\\r?\\n|\\r|^)" +
|
||||
|
||||
// Quoted fields.
|
||||
"(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" +
|
||||
|
||||
// Standard fields.
|
||||
"([^\"\\" + strDelimiter + "\\r\\n]*))"
|
||||
),
|
||||
"gi"
|
||||
);
|
||||
|
||||
|
||||
// Create an array to hold our data. Give the array
|
||||
// a default empty first row.
|
||||
var arrData = [
|
||||
[]
|
||||
];
|
||||
|
||||
// Create an array to hold our individual pattern
|
||||
// matching groups.
|
||||
var arrMatches = null;
|
||||
|
||||
|
||||
// Keep looping over the regular expression matches
|
||||
// until we can no longer find a match.
|
||||
while ( ( arrMatches = objPattern.exec( strData ) ) ) {
|
||||
|
||||
// Get the delimiter that was found.
|
||||
var strMatchedDelimiter = arrMatches[ 1 ];
|
||||
|
||||
// Check to see if the given delimiter has a length
|
||||
// (is not the start of string) and if it matches
|
||||
// field delimiter. If id does not, then we know
|
||||
// that this delimiter is a row delimiter.
|
||||
if (
|
||||
strMatchedDelimiter.length &&
|
||||
( strMatchedDelimiter !== strDelimiter )
|
||||
) {
|
||||
|
||||
// Since we have reached a new row of data,
|
||||
// add an empty row to our data array.
|
||||
arrData.push( [] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Now that we have our delimiter out of the way,
|
||||
// let's check to see which kind of value we
|
||||
// captured (quoted or unquoted).
|
||||
var strMatchedValue;
|
||||
if ( arrMatches[ 2 ] ) {
|
||||
|
||||
// We found a quoted value. When we capture
|
||||
// this value, unescape any double quotes.
|
||||
strMatchedValue = arrMatches[ 2 ].replace(
|
||||
new RegExp( "\"\"", "g" ),
|
||||
"\""
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
// We found a non-quoted value.
|
||||
strMatchedValue = arrMatches[ 3 ];
|
||||
|
||||
}
|
||||
|
||||
// Now that we have our value string, let's add
|
||||
// it to the data array.
|
||||
arrData[ arrData.length - 1 ].push( strMatchedValue );
|
||||
}
|
||||
|
||||
// Return the parsed data.
|
||||
return ( arrData );
|
||||
};
|
||||
|
||||
/**
|
||||
* Appends timestamp to the url
|
||||
*/
|
||||
AmCharts.timestampUrl = function( url ) {
|
||||
var p = url.split( '?' );
|
||||
if ( 1 === p.length )
|
||||
p[ 1 ] = new Date().getTime();
|
||||
else
|
||||
p[ 1 ] += '&' + new Date().getTime();
|
||||
return p.join( '?' );
|
||||
};
|
1
web/js/amcharts/plugins/dataloader/dataloader.min.js
vendored
Normal file
1
web/js/amcharts/plugins/dataloader/dataloader.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3674
web/js/amcharts/plugins/dataloader/examples/data/MSFT.csv
Normal file
3674
web/js/amcharts/plugins/dataloader/examples/data/MSFT.csv
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,56 @@
|
|||
Date,Type,Title,Description
|
||||
2014-06-05,A,Analyst opinion change,Upgrade by FBR Capital from Mkt Perform to Outperform
|
||||
2014-05-13,D,Dividend,Amount: 0.28
|
||||
2014-02-18,D,Dividend,Amount: 0.28
|
||||
2014-01-23,A,Analyst opinion change,Upgrade from Deutsche Bank from Hold to Buy
|
||||
2014-01-10,A,Analyst opinion change,Upgrade from Barclays from Equal weight to Overweight
|
||||
2013-11-19,D,Dividend,Amount: 0.28
|
||||
2013-08-13,D,Dividend,Amount: 0.28
|
||||
2013-08-13,A,Analyst opinion change,Downgrade from Stifel from Buy to Hold
|
||||
2013-05-14,D,Dividend,Amount: 0.23
|
||||
2013-04-30,A,Analyst opinion change,Downgrade from Standpoint Research from Buy to Hold
|
||||
2013-02-19,D,Dividend,Amount: 0.23
|
||||
2013-01-04,A,Analyst opinion change,Downgrade from Argus from Buy to Hold
|
||||
2012-12-14,A,Analyst opinion change,Initiated by BMO Capital Markets
|
||||
2012-12-12,A,Analyst opinion change,Upgrade from Standpoint Research from Hold to Buy
|
||||
2012-11-13,D,Dividend,Amount: 0.23
|
||||
2012-08-20,A,Analyst opinion change,Initiated by Longbow
|
||||
2012-08-14,D,Dividend,Amount: 0.20
|
||||
2012-07-20,A,Analyst opinion change,Initiated by Griffin Securities
|
||||
2012-05-15,D,Dividend,Amount: 0.20
|
||||
2012-04-20,A,Analyst opinion change,Initiated by MKM Partners
|
||||
2012-03-16,A,Analyst opinion change,Upgrade from Argus from Hold to Buy
|
||||
2012-02-14,D,Dividend,Amount: 0.20
|
||||
2011-12-06,A,Analyst opinion change,Initiated by Barclays Capital
|
||||
2011-11-15,D,Dividend,Amount: 0.20
|
||||
2011-09-09,A,Analyst opinion change,Downgrade from Standpoint Research from Buy to Hold
|
||||
2011-08-16,D,Dividend,Amount: 0.16
|
||||
2011-05-17,D,Dividend,Amount: 0.16
|
||||
2011-02-17,A,Analyst opinion change,Initiated by Collins Stewart
|
||||
2011-02-15,D,Dividend,Amount: 0.16
|
||||
2011-01-07,A,Analyst opinion change,Downgrade from Standpoint Research from Buy to Hold
|
||||
2010-11-16,D,Dividend,Amount: 0.16
|
||||
2010-10-25,A,Analyst opinion change,Downgrade by FBR Capital from Outperform to Mkt Perform
|
||||
2010-09-13,A,Analyst opinion change,Initiated by Standpoint Research
|
||||
2010-08-17,D,Dividend,Amount: 0.13
|
||||
2010-07-23,A,Analyst opinion change,Upgrade from Benchmark Company from Sell to Hold
|
||||
2010-05-27,A,Analyst opinion change,Upgrade by FBR Capital from Mkt Perform to Outperform
|
||||
2010-05-18,D,Dividend,Amount: 0.13
|
||||
2010-04-16,A,Analyst opinion change,Initiated by Janney Mntgmy Scott
|
||||
2010-04-08,A,Analyst opinion change,Initiated by Soleil
|
||||
2010-02-17,A,Analyst opinion change,Initiated Citigroup
|
||||
2010-02-16,D,Dividend,Amount: 0.13
|
||||
2009-11-17,D,Dividend,Amount: 0.13
|
||||
2009-11-13,A,Analyst opinion change,Initiated UBS
|
||||
2009-10-27,A,Analyst opinion change,Upgrade from Argus from Sell to Hold
|
||||
2009-09-14,A,Analyst opinion change,Upgrade from Auriga U.S.A from Hold to Buy
|
||||
2009-08-18,D,Dividend,Amount: 0.13
|
||||
2009-08-18,A,Analyst opinion change,Upgrade from AmTech Research from Neutral to Buy
|
||||
2009-07-24,A,Analyst opinion change,Downgrade by FBR Capital from Outperform to Mkt Perform
|
||||
2009-05-19,D,Dividend,Amount: 0.13
|
||||
2009-04-13,A,Analyst opinion change,Initiated AmTech Research
|
||||
2009-04-07,A,Analyst opinion change,Upgrade from RBC Capital Mkts from Sector Perform to Outperform
|
||||
2009-03-31,A,Analyst opinion change,Upgrade from Davenport from Neutral to Buy
|
||||
2009-03-27,A,Analyst opinion change,Initiated Auriga U.S.A
|
||||
2009-02-17,D,Dividend,Amount: 0.13
|
||||
2009-01-23,A,Analyst opinion change,Downgrade from Davenport from Buy to Neutral
|
|
3674
web/js/amcharts/plugins/dataloader/examples/data/TXN.csv
Normal file
3674
web/js/amcharts/plugins/dataloader/examples/data/TXN.csv
Normal file
File diff suppressed because it is too large
Load diff
237
web/js/amcharts/plugins/dataloader/examples/data/gantt.json
Normal file
237
web/js/amcharts/plugins/dataloader/examples/data/gantt.json
Normal file
|
@ -0,0 +1,237 @@
|
|||
[ {
|
||||
"category": "John",
|
||||
"segments": [ {
|
||||
"start": 7,
|
||||
"duration": 2,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Smith",
|
||||
"segments": [ {
|
||||
"start": 10,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 1,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
}, {
|
||||
"duration": 4,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Ben",
|
||||
"segments": [ {
|
||||
"start": 12,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"start": 16,
|
||||
"duration": 2,
|
||||
"color": "#FFE4C4",
|
||||
"task": "Task #4"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Mike",
|
||||
"segments": [ {
|
||||
"start": 9,
|
||||
"duration": 6,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 4,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Lenny",
|
||||
"segments": [ {
|
||||
"start": 8,
|
||||
"duration": 1,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
}, {
|
||||
"duration": 4,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Scott",
|
||||
"segments": [ {
|
||||
"start": 15,
|
||||
"duration": 3,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Julia",
|
||||
"segments": [ {
|
||||
"start": 9,
|
||||
"duration": 2,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 1,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 8,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Bob",
|
||||
"segments": [ {
|
||||
"start": 9,
|
||||
"duration": 8,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 7,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Kendra",
|
||||
"segments": [ {
|
||||
"start": 11,
|
||||
"duration": 8,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"start": 16,
|
||||
"duration": 2,
|
||||
"color": "#FFE4C4",
|
||||
"task": "Task #4"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Tom",
|
||||
"segments": [ {
|
||||
"start": 9,
|
||||
"duration": 4,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 3,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 5,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Kyle",
|
||||
"segments": [ {
|
||||
"start": 6,
|
||||
"duration": 3,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Anita",
|
||||
"segments": [ {
|
||||
"start": 12,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"start": 16,
|
||||
"duration": 2,
|
||||
"color": "#FFE4C4",
|
||||
"task": "Task #4"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Jack",
|
||||
"segments": [ {
|
||||
"start": 8,
|
||||
"duration": 10,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Kim",
|
||||
"segments": [ {
|
||||
"start": 12,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 3,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Aaron",
|
||||
"segments": [ {
|
||||
"start": 18,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#FFE4C4",
|
||||
"task": "Task #4"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Alan",
|
||||
"segments": [ {
|
||||
"start": 17,
|
||||
"duration": 2,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 2,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Ruth",
|
||||
"segments": [ {
|
||||
"start": 13,
|
||||
"duration": 2,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"duration": 1,
|
||||
"color": "#CF794A",
|
||||
"task": "Task #3"
|
||||
}, {
|
||||
"duration": 4,
|
||||
"color": "#7B742C",
|
||||
"task": "Task #1"
|
||||
} ]
|
||||
}, {
|
||||
"category": "Simon",
|
||||
"segments": [ {
|
||||
"start": 10,
|
||||
"duration": 3,
|
||||
"color": "#7E585F",
|
||||
"task": "Task #2"
|
||||
}, {
|
||||
"start": 17,
|
||||
"duration": 4,
|
||||
"color": "#FFE4C4",
|
||||
"task": "Task #4"
|
||||
} ]
|
||||
} ]
|
25
web/js/amcharts/plugins/dataloader/examples/data/gauge.json
Normal file
25
web/js/amcharts/plugins/dataloader/examples/data/gauge.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
[ {
|
||||
"innerRadius": 70,
|
||||
"nailRadius": 0,
|
||||
"radius": "80%",
|
||||
"startWidth": 10,
|
||||
"endWidth": 10,
|
||||
"value": 4
|
||||
}, {
|
||||
"innerRadius": 70,
|
||||
"nailRadius": 0,
|
||||
"radius": "100%",
|
||||
"startWidth": 6,
|
||||
"endWidth": 6,
|
||||
"value": 8
|
||||
}, {
|
||||
"axis": "axis2",
|
||||
"color": "#CC0000",
|
||||
"innerRadius": 50,
|
||||
"nailRadius": 0,
|
||||
"radius": "100%",
|
||||
"startWidth": 6,
|
||||
"endWidth": 6,
|
||||
"alpha": 1,
|
||||
"value": 11
|
||||
} ]
|
155
web/js/amcharts/plugins/dataloader/examples/data/map.json
Normal file
155
web/js/amcharts/plugins/dataloader/examples/data/map.json
Normal file
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
"map": "usaLow",
|
||||
"areas": [{
|
||||
"id": "US-AL",
|
||||
"value": 4447100
|
||||
}, {
|
||||
"id": "US-AK",
|
||||
"value": 626932
|
||||
}, {
|
||||
"id": "US-AZ",
|
||||
"value": 5130632
|
||||
}, {
|
||||
"id": "US-AR",
|
||||
"value": 2673400
|
||||
}, {
|
||||
"id": "US-CA",
|
||||
"value": 33871648
|
||||
}, {
|
||||
"id": "US-CO",
|
||||
"value": 4301261
|
||||
}, {
|
||||
"id": "US-CT",
|
||||
"value": 3405565
|
||||
}, {
|
||||
"id": "US-DE",
|
||||
"value": 783600
|
||||
}, {
|
||||
"id": "US-FL",
|
||||
"value": 15982378
|
||||
}, {
|
||||
"id": "US-GA",
|
||||
"value": 8186453
|
||||
}, {
|
||||
"id": "US-HI",
|
||||
"value": 1211537
|
||||
}, {
|
||||
"id": "US-ID",
|
||||
"value": 1293953
|
||||
}, {
|
||||
"id": "US-IL",
|
||||
"value": 12419293
|
||||
}, {
|
||||
"id": "US-IN",
|
||||
"value": 6080485
|
||||
}, {
|
||||
"id": "US-IA",
|
||||
"value": 2926324
|
||||
}, {
|
||||
"id": "US-KS",
|
||||
"value": 2688418
|
||||
}, {
|
||||
"id": "US-KY",
|
||||
"value": 4041769
|
||||
}, {
|
||||
"id": "US-LA",
|
||||
"value": 4468976
|
||||
}, {
|
||||
"id": "US-ME",
|
||||
"value": 1274923
|
||||
}, {
|
||||
"id": "US-MD",
|
||||
"value": 5296486
|
||||
}, {
|
||||
"id": "US-MA",
|
||||
"value": 6349097
|
||||
}, {
|
||||
"id": "US-MI",
|
||||
"value": 9938444
|
||||
}, {
|
||||
"id": "US-MN",
|
||||
"value": 4919479
|
||||
}, {
|
||||
"id": "US-MS",
|
||||
"value": 2844658
|
||||
}, {
|
||||
"id": "US-MO",
|
||||
"value": 5595211
|
||||
}, {
|
||||
"id": "US-MT",
|
||||
"value": 902195
|
||||
}, {
|
||||
"id": "US-NE",
|
||||
"value": 1711263
|
||||
}, {
|
||||
"id": "US-NV",
|
||||
"value": 1998257
|
||||
}, {
|
||||
"id": "US-NH",
|
||||
"value": 1235786
|
||||
}, {
|
||||
"id": "US-NJ",
|
||||
"value": 8414350
|
||||
}, {
|
||||
"id": "US-NM",
|
||||
"value": 1819046
|
||||
}, {
|
||||
"id": "US-NY",
|
||||
"value": 18976457
|
||||
}, {
|
||||
"id": "US-NC",
|
||||
"value": 8049313
|
||||
}, {
|
||||
"id": "US-ND",
|
||||
"value": 642200
|
||||
}, {
|
||||
"id": "US-OH",
|
||||
"value": 11353140
|
||||
}, {
|
||||
"id": "US-OK",
|
||||
"value": 3450654
|
||||
}, {
|
||||
"id": "US-OR",
|
||||
"value": 3421399
|
||||
}, {
|
||||
"id": "US-PA",
|
||||
"value": 12281054
|
||||
}, {
|
||||
"id": "US-RI",
|
||||
"value": 1048319
|
||||
}, {
|
||||
"id": "US-SC",
|
||||
"value": 4012012
|
||||
}, {
|
||||
"id": "US-SD",
|
||||
"value": 754844
|
||||
}, {
|
||||
"id": "US-TN",
|
||||
"value": 5689283
|
||||
}, {
|
||||
"id": "US-TX",
|
||||
"value": 20851820,
|
||||
"description": "<p>Texas is the second most populous (after California) and the second largest of the 50 U.S. states (after Alaska) in the United States of America, and the largest state in the 48 contiguous United States. Geographically located in the south central part of the country, Texas shares an international border with the Mexican states of Chihuahua, Coahuila, Nuevo León, and Tamaulipas to the south and borders the U.S. states of New Mexico to the west, Oklahoma to the north, Arkansas to the northeast, and Louisiana to the east. Texas has an area of 268,820 square miles (696,200 km2) and a growing population of over 26.9 million residents (July 2014).</p>"
|
||||
}, {
|
||||
"id": "US-UT",
|
||||
"value": 2233169
|
||||
}, {
|
||||
"id": "US-VT",
|
||||
"value": 608827
|
||||
}, {
|
||||
"id": "US-VA",
|
||||
"value": 7078515
|
||||
}, {
|
||||
"id": "US-WA",
|
||||
"value": 5894121
|
||||
}, {
|
||||
"id": "US-WV",
|
||||
"value": 1808344
|
||||
}, {
|
||||
"id": "US-WI",
|
||||
"value": 5363675
|
||||
}, {
|
||||
"id": "US-WY",
|
||||
"value": 493782
|
||||
}]
|
||||
}
|
152
web/js/amcharts/plugins/dataloader/examples/data/map_areas.json
Normal file
152
web/js/amcharts/plugins/dataloader/examples/data/map_areas.json
Normal file
|
@ -0,0 +1,152 @@
|
|||
[ {
|
||||
"id": "US-AL",
|
||||
"value": 4447100
|
||||
}, {
|
||||
"id": "US-AK",
|
||||
"value": 626932
|
||||
}, {
|
||||
"id": "US-AZ",
|
||||
"value": 5130632
|
||||
}, {
|
||||
"id": "US-AR",
|
||||
"value": 2673400
|
||||
}, {
|
||||
"id": "US-CA",
|
||||
"value": 33871648
|
||||
}, {
|
||||
"id": "US-CO",
|
||||
"value": 4301261
|
||||
}, {
|
||||
"id": "US-CT",
|
||||
"value": 3405565
|
||||
}, {
|
||||
"id": "US-DE",
|
||||
"value": 783600
|
||||
}, {
|
||||
"id": "US-FL",
|
||||
"value": 15982378
|
||||
}, {
|
||||
"id": "US-GA",
|
||||
"value": 8186453
|
||||
}, {
|
||||
"id": "US-HI",
|
||||
"value": 1211537
|
||||
}, {
|
||||
"id": "US-ID",
|
||||
"value": 1293953
|
||||
}, {
|
||||
"id": "US-IL",
|
||||
"value": 12419293
|
||||
}, {
|
||||
"id": "US-IN",
|
||||
"value": 6080485
|
||||
}, {
|
||||
"id": "US-IA",
|
||||
"value": 2926324
|
||||
}, {
|
||||
"id": "US-KS",
|
||||
"value": 2688418
|
||||
}, {
|
||||
"id": "US-KY",
|
||||
"value": 4041769
|
||||
}, {
|
||||
"id": "US-LA",
|
||||
"value": 4468976
|
||||
}, {
|
||||
"id": "US-ME",
|
||||
"value": 1274923
|
||||
}, {
|
||||
"id": "US-MD",
|
||||
"value": 5296486
|
||||
}, {
|
||||
"id": "US-MA",
|
||||
"value": 6349097
|
||||
}, {
|
||||
"id": "US-MI",
|
||||
"value": 9938444
|
||||
}, {
|
||||
"id": "US-MN",
|
||||
"value": 4919479
|
||||
}, {
|
||||
"id": "US-MS",
|
||||
"value": 2844658
|
||||
}, {
|
||||
"id": "US-MO",
|
||||
"value": 5595211
|
||||
}, {
|
||||
"id": "US-MT",
|
||||
"value": 902195
|
||||
}, {
|
||||
"id": "US-NE",
|
||||
"value": 1711263
|
||||
}, {
|
||||
"id": "US-NV",
|
||||
"value": 1998257
|
||||
}, {
|
||||
"id": "US-NH",
|
||||
"value": 1235786
|
||||
}, {
|
||||
"id": "US-NJ",
|
||||
"value": 8414350
|
||||
}, {
|
||||
"id": "US-NM",
|
||||
"value": 1819046
|
||||
}, {
|
||||
"id": "US-NY",
|
||||
"value": 18976457
|
||||
}, {
|
||||
"id": "US-NC",
|
||||
"value": 8049313
|
||||
}, {
|
||||
"id": "US-ND",
|
||||
"value": 642200
|
||||
}, {
|
||||
"id": "US-OH",
|
||||
"value": 11353140
|
||||
}, {
|
||||
"id": "US-OK",
|
||||
"value": 3450654
|
||||
}, {
|
||||
"id": "US-OR",
|
||||
"value": 3421399
|
||||
}, {
|
||||
"id": "US-PA",
|
||||
"value": 12281054
|
||||
}, {
|
||||
"id": "US-RI",
|
||||
"value": 1048319
|
||||
}, {
|
||||
"id": "US-SC",
|
||||
"value": 4012012
|
||||
}, {
|
||||
"id": "US-SD",
|
||||
"value": 754844
|
||||
}, {
|
||||
"id": "US-TN",
|
||||
"value": 5689283
|
||||
}, {
|
||||
"id": "US-TX",
|
||||
"value": 20851820,
|
||||
"description": "<p>Texas is the second most populous (after California) and the second largest of the 50 U.S. states (after Alaska) in the United States of America, and the largest state in the 48 contiguous United States. Geographically located in the south central part of the country, Texas shares an international border with the Mexican states of Chihuahua, Coahuila, Nuevo León, and Tamaulipas to the south and borders the U.S. states of New Mexico to the west, Oklahoma to the north, Arkansas to the northeast, and Louisiana to the east. Texas has an area of 268,820 square miles (696,200 km2) and a growing population of over 26.9 million residents (July 2014).</p>"
|
||||
}, {
|
||||
"id": "US-UT",
|
||||
"value": 2233169
|
||||
}, {
|
||||
"id": "US-VT",
|
||||
"value": 608827
|
||||
}, {
|
||||
"id": "US-VA",
|
||||
"value": 7078515
|
||||
}, {
|
||||
"id": "US-WA",
|
||||
"value": 5894121
|
||||
}, {
|
||||
"id": "US-WV",
|
||||
"value": 1808344
|
||||
}, {
|
||||
"id": "US-WI",
|
||||
"value": 5363675
|
||||
}, {
|
||||
"id": "US-WY",
|
||||
"value": 493782
|
||||
} ]
|
8
web/js/amcharts/plugins/dataloader/examples/data/pie.csv
Normal file
8
web/js/amcharts/plugins/dataloader/examples/data/pie.csv
Normal file
|
@ -0,0 +1,8 @@
|
|||
country,litres
|
||||
"Czech Republic",156.9
|
||||
"Ireland",131.1
|
||||
"Germany",115.8
|
||||
"Australia",109.9
|
||||
"Austria",108.3
|
||||
"UK",65
|
||||
"Belgium",50
|
|
22
web/js/amcharts/plugins/dataloader/examples/data/pie.json
Normal file
22
web/js/amcharts/plugins/dataloader/examples/data/pie.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
[{
|
||||
"country": "Czech Republic",
|
||||
"litres": 156.9
|
||||
}, {
|
||||
"country": "Ireland",
|
||||
"litres": 131.1
|
||||
}, {
|
||||
"country": "Germany",
|
||||
"litres": 115.8
|
||||
}, {
|
||||
"country": "Australia",
|
||||
"litres": 109.9
|
||||
}, {
|
||||
"country": "Austria",
|
||||
"litres": 108.3
|
||||
}, {
|
||||
"country": "UK",
|
||||
"litres": 65
|
||||
}, {
|
||||
"country": "Belgium",
|
||||
"litres": 50
|
||||
}]
|
20
web/js/amcharts/plugins/dataloader/examples/data/serial.csv
Normal file
20
web/js/amcharts/plugins/dataloader/examples/data/serial.csv
Normal file
|
@ -0,0 +1,20 @@
|
|||
year,cars,motorcycles,bicycles
|
||||
2000,1587,650,121
|
||||
1995,1567,683,146
|
||||
1996,1617,691,138
|
||||
1997,1630,642,127
|
||||
1998,1660,699,105
|
||||
1999,1683,721,109
|
||||
2000,1691,737,112
|
||||
2001,1298,680,101
|
||||
2002,1275,664,97
|
||||
2003,1246,648,93
|
||||
2004,1218,637,101
|
||||
2005,1213,633,87
|
||||
2006,1199,621,79
|
||||
2007,1110,210,81
|
||||
2008,1165,232,75
|
||||
2009,1145,219,88
|
||||
2010,1163,201,82
|
||||
2011,1180,285,87
|
||||
2012,1159,277,71
|
|
96
web/js/amcharts/plugins/dataloader/examples/data/serial.json
Normal file
96
web/js/amcharts/plugins/dataloader/examples/data/serial.json
Normal file
|
@ -0,0 +1,96 @@
|
|||
[{
|
||||
"year": 2000,
|
||||
"cars": 1587,
|
||||
"motorcycles": 650,
|
||||
"bicycles": 121
|
||||
}, {
|
||||
"year": 1995,
|
||||
"cars": 1567,
|
||||
"motorcycles": 683,
|
||||
"bicycles": 146
|
||||
}, {
|
||||
"year": 1996,
|
||||
"cars": 1617,
|
||||
"motorcycles": 691,
|
||||
"bicycles": 138
|
||||
}, {
|
||||
"year": 1997,
|
||||
"cars": 1630,
|
||||
"motorcycles": 642,
|
||||
"bicycles": 127
|
||||
}, {
|
||||
"year": 1998,
|
||||
"cars": 1660,
|
||||
"motorcycles": 699,
|
||||
"bicycles": 105
|
||||
}, {
|
||||
"year": 1999,
|
||||
"cars": 1683,
|
||||
"motorcycles": 721,
|
||||
"bicycles": 109
|
||||
}, {
|
||||
"year": 2000,
|
||||
"cars": 1691,
|
||||
"motorcycles": 737,
|
||||
"bicycles": 112
|
||||
}, {
|
||||
"year": 2001,
|
||||
"cars": 1298,
|
||||
"motorcycles": 680,
|
||||
"bicycles": 101
|
||||
}, {
|
||||
"year": 2002,
|
||||
"cars": 1275,
|
||||
"motorcycles": 664,
|
||||
"bicycles": 97
|
||||
}, {
|
||||
"year": 2003,
|
||||
"cars": 1246,
|
||||
"motorcycles": 648,
|
||||
"bicycles": 93
|
||||
}, {
|
||||
"year": 2004,
|
||||
"cars": 1218,
|
||||
"motorcycles": 637,
|
||||
"bicycles": 101
|
||||
}, {
|
||||
"year": 2005,
|
||||
"cars": 1213,
|
||||
"motorcycles": 633,
|
||||
"bicycles": 87
|
||||
}, {
|
||||
"year": 2006,
|
||||
"cars": 1199,
|
||||
"motorcycles": 621,
|
||||
"bicycles": 79
|
||||
}, {
|
||||
"year": 2007,
|
||||
"cars": 1110,
|
||||
"motorcycles": 210,
|
||||
"bicycles": 81
|
||||
}, {
|
||||
"year": 2008,
|
||||
"cars": 1165,
|
||||
"motorcycles": 232,
|
||||
"bicycles": 75
|
||||
}, {
|
||||
"year": 2009,
|
||||
"cars": 1145,
|
||||
"motorcycles": 219,
|
||||
"bicycles": 88
|
||||
}, {
|
||||
"year": 2010,
|
||||
"cars": 1163,
|
||||
"motorcycles": 201,
|
||||
"bicycles": 82
|
||||
}, {
|
||||
"year": 2011,
|
||||
"cars": 1180,
|
||||
"motorcycles": 285,
|
||||
"bicycles": 87
|
||||
}, {
|
||||
"year": 2012,
|
||||
"cars": 1159,
|
||||
"motorcycles": 277,
|
||||
"bicycles": 71
|
||||
}]
|
|
@ -0,0 +1,21 @@
|
|||
[{
|
||||
"year": 2005,
|
||||
"income": 23.5,
|
||||
"expenses": 18.1
|
||||
}, {
|
||||
"year": 2006,
|
||||
"income": 26.2,
|
||||
"expenses": 22.8
|
||||
}, {
|
||||
"year": 2007,
|
||||
"income": 30.1,
|
||||
"expenses": 23.9
|
||||
}, {
|
||||
"year": 2008,
|
||||
"income": 29.5,
|
||||
"expenses": 25.1
|
||||
}, {
|
||||
"year": 2009,
|
||||
"income": 24.6,
|
||||
"expenses": 25
|
||||
}]
|
70
web/js/amcharts/plugins/dataloader/examples/gantt_json.html
Normal file
70
web/js/amcharts/plugins/dataloader/examples/gantt_json.html
Normal file
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/gantt.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
AmCharts.useUTC = true;
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "gantt",
|
||||
"theme": "light",
|
||||
"dataLoader": {
|
||||
"url": "data/gantt.json"
|
||||
},
|
||||
"dataProvider": [],
|
||||
"period": "hh",
|
||||
"dataDateFormat": "YYYY-MM-DD",
|
||||
"balloonDateFormat": "JJ:NN",
|
||||
"columnWidth": 0.5,
|
||||
"valueAxis": {
|
||||
"type": "date",
|
||||
"minimum": 7,
|
||||
"maximum": 31
|
||||
},
|
||||
"brightnessStep": 10,
|
||||
"graph": {
|
||||
"fillAlphas": 1,
|
||||
"balloonText": "<b>[[task]]</b>: [[open]] [[value]]"
|
||||
},
|
||||
"rotate": true,
|
||||
"categoryField": "category",
|
||||
"segmentsField": "segments",
|
||||
"colorField": "color",
|
||||
"startDate": "2015-01-01",
|
||||
"startField": "start",
|
||||
"endField": "end",
|
||||
"durationField": "duration",
|
||||
"chartScrollbar": {},
|
||||
"chartCursor": {
|
||||
"valueBalloonsEnabled": false,
|
||||
"cursorAlpha": 0.1,
|
||||
"valueLineBalloonEnabled": true,
|
||||
"valueLineEnabled": true,
|
||||
"fullWidth": true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
58
web/js/amcharts/plugins/dataloader/examples/gauge_json.html
Normal file
58
web/js/amcharts/plugins/dataloader/examples/gauge_json.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/gauge.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart( "chartdiv", {
|
||||
"type": "gauge",
|
||||
"startDuration": 0.1,
|
||||
"dataLoader": {
|
||||
"url": "data/gauge.json"
|
||||
},
|
||||
"axes": [ {
|
||||
"id": "axis1",
|
||||
"axisAlpha": 0,
|
||||
"endAngle": 360,
|
||||
"endValue": 12,
|
||||
"minorTickInterval": 0.2,
|
||||
"showFirstLabel": false,
|
||||
"startAngle": 0,
|
||||
"topTextYOffset": 100,
|
||||
"valueInterval": 1
|
||||
}, {
|
||||
"id": "axis2",
|
||||
"axisAlpha": 0,
|
||||
"endAngle": 360,
|
||||
"endValue": 60,
|
||||
"radius": 60,
|
||||
"showFirstLabel": false,
|
||||
"startAngle": 0,
|
||||
"valueInterval": 5,
|
||||
"labelFrequency": 0,
|
||||
"tickLength": 10
|
||||
} ]
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
47
web/js/amcharts/plugins/dataloader/examples/map_json.html
Normal file
47
web/js/amcharts/plugins/dataloader/examples/map_json.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<link rel="stylesheet" href="http://www.amcharts.com/lib/3/ammap.css" type="text/css">
|
||||
<script src="http://www.amcharts.com/lib/3/ammap.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/maps/js/usaLow.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var map = AmCharts.makeChart( "chartdiv", {
|
||||
type: "map",
|
||||
"dataLoader": {
|
||||
"url": "data/map.json",
|
||||
"showErrors": false
|
||||
},
|
||||
"colorSteps": 10,
|
||||
"areasSettings": {
|
||||
"autoZoom": true
|
||||
},
|
||||
"smallMap": {},
|
||||
"valueLegend": {
|
||||
"right": 10,
|
||||
"minValue": "little",
|
||||
"maxValue": "a lot!"
|
||||
}
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<link rel="stylesheet" href="http://www.amcharts.com/lib/3/ammap.css" type="text/css">
|
||||
<script src="http://www.amcharts.com/lib/3/ammap.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/maps/js/usaLow.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
/**
|
||||
* We will use Data Loader's function to load data "externally"
|
||||
* then create a map when it's loaded
|
||||
*/
|
||||
AmCharts.loadFile( "data/map_areas.json", {}, function( areas ) {
|
||||
|
||||
// now that we loaded our areas, let's create the map
|
||||
var map = AmCharts.makeChart( "chartdiv", {
|
||||
"type": "map",
|
||||
"colorSteps": 10,
|
||||
"dataProvider": {
|
||||
"map": "usaLow",
|
||||
"areas": AmCharts.parseJSON( areas )
|
||||
},
|
||||
"areasSettings": {
|
||||
"autoZoom": true
|
||||
},
|
||||
"valueLegend": {
|
||||
"right": 10,
|
||||
"minValue": "little",
|
||||
"maxValue": "a lot!"
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
58
web/js/amcharts/plugins/dataloader/examples/pie_csv.html
Normal file
58
web/js/amcharts/plugins/dataloader/examples/pie_csv.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/pie.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
AmCharts.makeChart("chartdiv", {
|
||||
"type": "pie",
|
||||
"dataLoader": {
|
||||
"url": "data/pie.csv",
|
||||
"format": "csv",
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
},
|
||||
"titleField": "country",
|
||||
"valueField": "litres",
|
||||
"balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
|
||||
"innerRadius": "30%",
|
||||
"legend": {
|
||||
"align": "center",
|
||||
"markerType": "circle"
|
||||
},
|
||||
"responsive": {
|
||||
"enabled": true,
|
||||
"addDefaultRules": true,
|
||||
"rules": [
|
||||
{
|
||||
"minWidth": 500,
|
||||
"overrides": {
|
||||
"innerRadius": "50%",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
44
web/js/amcharts/plugins/dataloader/examples/pie_json.html
Normal file
44
web/js/amcharts/plugins/dataloader/examples/pie_json.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/pie.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
AmCharts.makeChart("chartdiv", {
|
||||
"type": "pie",
|
||||
"dataLoader": {
|
||||
"url": "data/pie.json",
|
||||
"showCurtain": false
|
||||
},
|
||||
"titleField": "country",
|
||||
"valueField": "litres",
|
||||
"balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>",
|
||||
"innerRadius": "30%",
|
||||
"legend": {
|
||||
"align": "center",
|
||||
"markerType": "circle"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,85 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/themes/dark.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
background-color:#282828;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"theme": "dark",
|
||||
"dataLoader": {
|
||||
"url": "data/serial2.json",
|
||||
"showErrors": true,
|
||||
"complete": function ( chart ) {
|
||||
console.log( "Loading complete" );
|
||||
},
|
||||
"load": function ( options, chart ) {
|
||||
console.log( "File loaded: ", options.url );
|
||||
},
|
||||
"error": function ( options, chart ) {
|
||||
console.log( "Error occured loading file: ", options.url );
|
||||
}
|
||||
},
|
||||
"categoryField": "year",
|
||||
"startDuration": 1,
|
||||
"rotate": true,
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start"
|
||||
},
|
||||
"valueAxes": [{
|
||||
"position": "top",
|
||||
"title": "Million USD",
|
||||
"minorGridEnabled": true
|
||||
}],
|
||||
"graphs": [{
|
||||
"type": "column",
|
||||
"title": "Income",
|
||||
"valueField": "income",
|
||||
"fillAlphas":1,
|
||||
"balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b></span>"
|
||||
}, {
|
||||
"type": "line",
|
||||
"title": "Expenses",
|
||||
"valueField": "expenses",
|
||||
"lineThickness": 2,
|
||||
"bullet": "round",
|
||||
"balloonText": "<span style='font-size:13px;'>[[title]] in [[category]]:<b>[[value]]</b></span>"
|
||||
}],
|
||||
"legend": {
|
||||
"useGraphSettings": true
|
||||
},
|
||||
"creditsPosition": "top-right",
|
||||
"responsive": {
|
||||
"enabled": true
|
||||
}
|
||||
});
|
||||
|
||||
function reloadData() {
|
||||
chart.dataLoader.loadData();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
<input type="button" value="Trigger data reload" onclick="reloadData();" />
|
||||
</body>
|
||||
|
||||
</html>
|
112
web/js/amcharts/plugins/dataloader/examples/serial_csv.html
Normal file
112
web/js/amcharts/plugins/dataloader/examples/serial_csv.html
Normal file
|
@ -0,0 +1,112 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"dataLoader": {
|
||||
"url": "data/serial.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": true,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reload": 10,
|
||||
"timestamp": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
},
|
||||
"rotate": false,
|
||||
"marginTop": 10,
|
||||
"categoryField": "year",
|
||||
"categoryAxis": {
|
||||
"gridAlpha": 0.07,
|
||||
"axisColor": "#DADADA",
|
||||
"startOnAxis": false,
|
||||
"title": "Year",
|
||||
"guides": [{
|
||||
"category": "2001",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "fines for speeding increased"
|
||||
}, {
|
||||
"category": "2007",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "motorcycle fee introduced"
|
||||
}]
|
||||
},
|
||||
"valueAxes": [{
|
||||
"stackType": "regular",
|
||||
"gridAlpha": 0.07,
|
||||
"title": "Traffic incidents"
|
||||
}],
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"type": "column",
|
||||
"title": "Cars",
|
||||
"valueField": "cars",
|
||||
"bullet": "round",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}, {
|
||||
"id": "g2",
|
||||
"type": "column",
|
||||
"title": "Motorcycles",
|
||||
"valueField": "motorcycles",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}, {
|
||||
"id": "g3",
|
||||
"type": "column",
|
||||
"title": "Bicycles",
|
||||
"valueField": "bicycles",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}],
|
||||
"legend": {
|
||||
"position": "bottom",
|
||||
"valueText": "[[value]]",
|
||||
"valueWidth": 100,
|
||||
"valueAlign": "left",
|
||||
"equalWidths": false,
|
||||
"periodValueText": "total: [[value.sum]]"
|
||||
},
|
||||
"chartCursor": {
|
||||
"cursorAlpha": 0
|
||||
},
|
||||
"chartScrollbar": {
|
||||
"color": "FFFFFF"
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
108
web/js/amcharts/plugins/dataloader/examples/serial_json.html
Normal file
108
web/js/amcharts/plugins/dataloader/examples/serial_json.html
Normal file
|
@ -0,0 +1,108 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"dataLoader": {
|
||||
"url": "data/serial.json",
|
||||
"format": "json",
|
||||
"showErrors": true,
|
||||
"noStyles": true,
|
||||
"async": true
|
||||
},
|
||||
"rotate": false,
|
||||
"marginTop": 10,
|
||||
"categoryField": "year",
|
||||
"categoryAxis": {
|
||||
"gridAlpha": 0.07,
|
||||
"axisColor": "#DADADA",
|
||||
"startOnAxis": false,
|
||||
"title": "Year",
|
||||
"guides": [{
|
||||
"category": "2001",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "fines for speeding increased"
|
||||
}, {
|
||||
"category": "2007",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "motorcycle fee introduced"
|
||||
}]
|
||||
},
|
||||
"valueAxes": [{
|
||||
"stackType": "regular",
|
||||
"gridAlpha": 0.07,
|
||||
"title": "Traffic incidents"
|
||||
}],
|
||||
"graphs": [{
|
||||
"id": "g1",
|
||||
"type": "column",
|
||||
"title": "Cars",
|
||||
"valueField": "cars",
|
||||
"bullet": "round",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}, {
|
||||
"id": "g2",
|
||||
"type": "column",
|
||||
"title": "Motorcycles",
|
||||
"valueField": "motorcycles",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}, {
|
||||
"id": "g3",
|
||||
"type": "column",
|
||||
"title": "Bicycles",
|
||||
"valueField": "bicycles",
|
||||
"lineAlpha": 0,
|
||||
"fillAlphas": 0.6
|
||||
}],
|
||||
"legend": {
|
||||
"position": "bottom",
|
||||
"valueText": "[[value]]",
|
||||
"valueWidth": 100,
|
||||
"valueAlign": "left",
|
||||
"equalWidths": false,
|
||||
"periodValueText": "total: [[value.sum]]"
|
||||
},
|
||||
"chartCursor": {
|
||||
"cursorAlpha": 0
|
||||
},
|
||||
"chartScrollbar": {
|
||||
"color": "FFFFFF"
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"dataLoader": {
|
||||
"url": "data/serial.json",
|
||||
"format": "json",
|
||||
"showErrors": true,
|
||||
"noStyles": true,
|
||||
"async": true,
|
||||
"load": function( options, chart ) {
|
||||
// Here the data is already loaded and set to the chart.
|
||||
// We can iterate through it and add proper graphs
|
||||
for ( var key in chart.dataProvider[ 0 ] ) {
|
||||
if ( chart.dataProvider[ 0 ].hasOwnProperty( key ) && key != chart.categoryField ) {
|
||||
var graph = new AmCharts.AmGraph();
|
||||
graph.valueField = key;
|
||||
graph.type = "line";
|
||||
graph.title = key,
|
||||
graph.lineThickness = 2;
|
||||
chart.addGraph( graph );
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rotate": false,
|
||||
"marginTop": 10,
|
||||
"categoryField": "year",
|
||||
"categoryAxis": {
|
||||
"gridAlpha": 0.07,
|
||||
"axisColor": "#DADADA",
|
||||
"startOnAxis": false,
|
||||
"title": "Year",
|
||||
"guides": [{
|
||||
"category": "2001",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "fines for speeding increased"
|
||||
}, {
|
||||
"category": "2007",
|
||||
"lineColor": "#CC0000",
|
||||
"lineAlpha": 1,
|
||||
"dashLength": 2,
|
||||
"inside": true,
|
||||
"labelRotation": 90,
|
||||
"label": "motorcycle fee introduced"
|
||||
}]
|
||||
},
|
||||
"valueAxes": [{
|
||||
"stackType": "regular",
|
||||
"gridAlpha": 0.07,
|
||||
"title": "Traffic incidents"
|
||||
}],
|
||||
"graphs": [],
|
||||
"legend": {
|
||||
"position": "bottom",
|
||||
"valueText": "[[value]]",
|
||||
"valueWidth": 100,
|
||||
"valueAlign": "left",
|
||||
"equalWidths": false,
|
||||
"periodValueText": "total: [[value.sum]]"
|
||||
},
|
||||
"chartCursor": {
|
||||
"cursorAlpha": 0
|
||||
},
|
||||
"chartScrollbar": {
|
||||
"color": "FFFFFF"
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,312 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/amstock.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
background: #000;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
position: relative;
|
||||
}
|
||||
#chartdiv .amChartsPeriodSelector {
|
||||
padding-left: 35px;
|
||||
}
|
||||
.amChartsButtonSelected {
|
||||
font-weight: bold;
|
||||
}
|
||||
.amChartsButton {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
opacity: 0.7;
|
||||
border: 1px solid rgba(255,255,2555,.3);
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin: 1px;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.amChartsInputField {
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "stock",
|
||||
"color": "#fff",
|
||||
"dataSets": [{
|
||||
"title": "MSFT",
|
||||
"fieldMappings": [{
|
||||
"fromField": "Open",
|
||||
"toField": "open"
|
||||
}, {
|
||||
"fromField": "High",
|
||||
"toField": "high"
|
||||
}, {
|
||||
"fromField": "Low",
|
||||
"toField": "low"
|
||||
}, {
|
||||
"fromField": "Close",
|
||||
"toField": "close"
|
||||
}, {
|
||||
"fromField": "Volume",
|
||||
"toField": "volume"
|
||||
}],
|
||||
"compared": false,
|
||||
"categoryField": "Date",
|
||||
|
||||
/**
|
||||
* data loader for data set data
|
||||
*/
|
||||
"dataLoader": {
|
||||
"url": "data/MSFT.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": true,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
},
|
||||
|
||||
/**
|
||||
* data loader for events data
|
||||
*/
|
||||
"eventDataLoader": {
|
||||
"url": "data/MSFT_events.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": true,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true,
|
||||
"postProcess": function ( data ) {
|
||||
for ( var x in data ) {
|
||||
switch( data[x].Type ) {
|
||||
case 'A':
|
||||
var color = "#85CDE6";
|
||||
break;
|
||||
default:
|
||||
var color = "#cccccc";
|
||||
break;
|
||||
}
|
||||
data[x].Description = data[x].Description.replace( "Upgrade", "<strong style=\"color: #0c0\">Upgrade</strong>" ).replace( "Downgrade", "<strong style=\"color: #c00\">Downgrade</strong>" );
|
||||
data[x] = {
|
||||
type: "pin",
|
||||
graph: "g1",
|
||||
backgroundColor: color,
|
||||
date: data[x].Date,
|
||||
text: data[x].Type,
|
||||
description: "<strong>" + data[x].Title + "</strong><br />" + data[x].Description
|
||||
};
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}, {
|
||||
"title": "TXN",
|
||||
"fieldMappings": [{
|
||||
"fromField": "Open",
|
||||
"toField": "open"
|
||||
}, {
|
||||
"fromField": "High",
|
||||
"toField": "high"
|
||||
}, {
|
||||
"fromField": "Low",
|
||||
"toField": "low"
|
||||
}, {
|
||||
"fromField": "Close",
|
||||
"toField": "close"
|
||||
}, {
|
||||
"fromField": "Volume",
|
||||
"toField": "volume"
|
||||
}],
|
||||
"compared": true,
|
||||
"categoryField": "Date",
|
||||
"dataLoader": {
|
||||
"url": "data/TXN.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": true,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
}
|
||||
}],
|
||||
"dataDateFormat": "YYYY-MM-DD",
|
||||
|
||||
"panels": [{
|
||||
"title": "Value",
|
||||
"percentHeight": 70,
|
||||
|
||||
"stockGraphs": [{
|
||||
"type": "candlestick",
|
||||
"id": "g1",
|
||||
"openField": "open",
|
||||
"closeField": "close",
|
||||
"highField": "high",
|
||||
"lowField": "low",
|
||||
"valueField": "close",
|
||||
"lineColor": "#fff",
|
||||
"fillColors": "#fff",
|
||||
"negativeLineColor": "#db4c3c",
|
||||
"negativeFillColors": "#db4c3c",
|
||||
"fillAlphas": 1,
|
||||
"comparedGraphLineThickness": 2,
|
||||
"columnWidth": 0.7,
|
||||
"useDataSetColors": false,
|
||||
"comparable": true,
|
||||
"compareField": "close",
|
||||
"showBalloon": false,
|
||||
"proCandlesticks": true
|
||||
}],
|
||||
|
||||
"stockLegend": {
|
||||
"valueTextRegular": undefined,
|
||||
"periodValueTextComparing": "[[percents.value.close]]%"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
"title": "Volume",
|
||||
"percentHeight": 30,
|
||||
"marginTop": 1,
|
||||
"columnWidth": 0.6,
|
||||
"showCategoryAxis": false,
|
||||
|
||||
"stockGraphs": [{
|
||||
"valueField": "volume",
|
||||
"openField": "open",
|
||||
"type": "column",
|
||||
"showBalloon": false,
|
||||
"fillAlphas": 1,
|
||||
"lineColor": "#fff",
|
||||
"fillColors": "#fff",
|
||||
"negativeLineColor": "#db4c3c",
|
||||
"negativeFillColors": "#db4c3c",
|
||||
"useDataSetColors": false
|
||||
}],
|
||||
|
||||
"stockLegend": {
|
||||
"markerType": "none",
|
||||
"markerSize": 0,
|
||||
"labelText": "",
|
||||
"periodValueTextRegular": "[[value.close]]"
|
||||
},
|
||||
|
||||
"valueAxes": [{
|
||||
"usePrefixes": true
|
||||
}]
|
||||
}
|
||||
],
|
||||
|
||||
"panelsSettings": {
|
||||
"color": "#fff",
|
||||
"plotAreaFillColors": "#333",
|
||||
"plotAreaFillAlphas": 1,
|
||||
"marginLeft": 60,
|
||||
"marginTop": 5,
|
||||
"marginBottom": 5
|
||||
},
|
||||
|
||||
"chartScrollbarSettings": {
|
||||
"graph": "g1",
|
||||
"graphType": "line",
|
||||
"usePeriod": "WW",
|
||||
"backgroundColor": "#333",
|
||||
"graphFillColor": "#666",
|
||||
"graphFillAlpha": 0.5,
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1,
|
||||
"selectedBackgroundColor": "#444",
|
||||
"selectedGraphFillAlpha": 1
|
||||
},
|
||||
|
||||
"categoryAxesSettings": {
|
||||
"equalSpacing": true,
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1
|
||||
},
|
||||
|
||||
"valueAxesSettings": {
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1,
|
||||
"inside": false,
|
||||
"showLastLabel": true
|
||||
},
|
||||
|
||||
"chartCursorSettings": {
|
||||
"pan": true,
|
||||
"valueLineEnabled": true,
|
||||
"valueLineBalloonEnabled": true
|
||||
},
|
||||
|
||||
"legendSettings": {
|
||||
"color": "#fff"
|
||||
},
|
||||
|
||||
"stockEventsSettings": {
|
||||
"showAt": "high",
|
||||
"type": "pin"
|
||||
},
|
||||
|
||||
"balloon": {
|
||||
"textAlign": "left",
|
||||
"offsetY": 10
|
||||
},
|
||||
|
||||
"periodSelector": {
|
||||
"position": "bottom",
|
||||
"periods": [{
|
||||
"period": "DD",
|
||||
"count": 10,
|
||||
"label": "10D"
|
||||
}, {
|
||||
"period": "MM",
|
||||
"count": 1,
|
||||
"label": "1M"
|
||||
}, {
|
||||
"period": "MM",
|
||||
"count": 6,
|
||||
"label": "6M"
|
||||
}, {
|
||||
"period": "YYYY",
|
||||
"count": 1,
|
||||
"label": "1Y"
|
||||
}, {
|
||||
"period": "YYYY",
|
||||
"count": 2,
|
||||
"selected": true,
|
||||
"label": "2Y"
|
||||
}, {
|
||||
"period": "YTD",
|
||||
"label": "YTD"
|
||||
}, {
|
||||
"period": "MAX",
|
||||
"label": "MAX"
|
||||
}]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartdiv"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,371 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>amCharts Data Loader Example</title>
|
||||
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="http://www.amcharts.com/lib/3/amstock.js"></script>
|
||||
<script src="../dataloader.min.js"></script>
|
||||
|
||||
<!-- jQuery UI resources used for progress bar -->
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
|
||||
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
|
||||
|
||||
<style>
|
||||
body, html {
|
||||
font-family: Verdana;
|
||||
font-size: 12px;
|
||||
background: #000;
|
||||
}
|
||||
#chartcontainer, #chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
position: relative;
|
||||
}
|
||||
#chartdiv .amChartsPeriodSelector {
|
||||
padding-left: 35px;
|
||||
}
|
||||
.amChartsButtonSelected {
|
||||
font-weight: bold;
|
||||
}
|
||||
.amChartsButton {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
opacity: 0.7;
|
||||
border: 1px solid rgba(255,255,2555,.3);
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin: 1px;
|
||||
outline: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.amChartsInputField {
|
||||
color: #000;
|
||||
}
|
||||
.ui-progressbar {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -15px;
|
||||
left: 50%;
|
||||
margin-left: -150px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
}
|
||||
.progress-label {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 4px;
|
||||
margin-left: -15px;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "stock",
|
||||
"color": "#fff",
|
||||
"dataSets": [{
|
||||
"title": "MSFT",
|
||||
"fieldMappings": [{
|
||||
"fromField": "Open",
|
||||
"toField": "open"
|
||||
}, {
|
||||
"fromField": "High",
|
||||
"toField": "high"
|
||||
}, {
|
||||
"fromField": "Low",
|
||||
"toField": "low"
|
||||
}, {
|
||||
"fromField": "Close",
|
||||
"toField": "close"
|
||||
}, {
|
||||
"fromField": "Volume",
|
||||
"toField": "volume"
|
||||
}],
|
||||
"compared": false,
|
||||
"categoryField": "Date",
|
||||
|
||||
/**
|
||||
* data loader for data set data
|
||||
*/
|
||||
"dataLoader": {
|
||||
"url": "data/MSFT.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": false,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true,
|
||||
"progress": udpateProgress
|
||||
},
|
||||
|
||||
/**
|
||||
* data loader for events data
|
||||
*/
|
||||
"eventDataLoader": {
|
||||
"url": "data/MSFT_events.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": false,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true,
|
||||
"progress": udpateProgress,
|
||||
"postProcess": function ( data ) {
|
||||
for ( var x in data ) {
|
||||
switch( data[x].Type ) {
|
||||
case 'A':
|
||||
var color = "#85CDE6";
|
||||
break;
|
||||
default:
|
||||
var color = "#cccccc";
|
||||
break;
|
||||
}
|
||||
data[x].Description = data[x].Description.replace( "Upgrade", "<strong style=\"color: #0c0\">Upgrade</strong>" ).replace( "Downgrade", "<strong style=\"color: #c00\">Downgrade</strong>" );
|
||||
data[x] = {
|
||||
type: "pin",
|
||||
graph: "g1",
|
||||
backgroundColor: color,
|
||||
date: data[x].Date,
|
||||
text: data[x].Type,
|
||||
description: "<strong>" + data[x].Title + "</strong><br />" + data[x].Description
|
||||
};
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}, {
|
||||
"title": "TXN",
|
||||
"fieldMappings": [{
|
||||
"fromField": "Open",
|
||||
"toField": "open"
|
||||
}, {
|
||||
"fromField": "High",
|
||||
"toField": "high"
|
||||
}, {
|
||||
"fromField": "Low",
|
||||
"toField": "low"
|
||||
}, {
|
||||
"fromField": "Close",
|
||||
"toField": "close"
|
||||
}, {
|
||||
"fromField": "Volume",
|
||||
"toField": "volume"
|
||||
}],
|
||||
"compared": true,
|
||||
"categoryField": "Date",
|
||||
"dataLoader": {
|
||||
"url": "data/TXN.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": false,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true,
|
||||
"progress": udpateProgress
|
||||
}
|
||||
}],
|
||||
"dataDateFormat": "YYYY-MM-DD",
|
||||
|
||||
"panels": [{
|
||||
"title": "Value",
|
||||
"percentHeight": 70,
|
||||
|
||||
"stockGraphs": [{
|
||||
"type": "candlestick",
|
||||
"id": "g1",
|
||||
"openField": "open",
|
||||
"closeField": "close",
|
||||
"highField": "high",
|
||||
"lowField": "low",
|
||||
"valueField": "close",
|
||||
"lineColor": "#fff",
|
||||
"fillColors": "#fff",
|
||||
"negativeLineColor": "#db4c3c",
|
||||
"negativeFillColors": "#db4c3c",
|
||||
"fillAlphas": 1,
|
||||
"comparedGraphLineThickness": 2,
|
||||
"columnWidth": 0.7,
|
||||
"useDataSetColors": false,
|
||||
"comparable": true,
|
||||
"compareField": "close",
|
||||
"showBalloon": false,
|
||||
"proCandlesticks": true
|
||||
}],
|
||||
|
||||
"stockLegend": {
|
||||
"valueTextRegular": undefined,
|
||||
"periodValueTextComparing": "[[percents.value.close]]%"
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
"title": "Volume",
|
||||
"percentHeight": 30,
|
||||
"marginTop": 1,
|
||||
"columnWidth": 0.6,
|
||||
"showCategoryAxis": false,
|
||||
|
||||
"stockGraphs": [{
|
||||
"valueField": "volume",
|
||||
"openField": "open",
|
||||
"type": "column",
|
||||
"showBalloon": false,
|
||||
"fillAlphas": 1,
|
||||
"lineColor": "#fff",
|
||||
"fillColors": "#fff",
|
||||
"negativeLineColor": "#db4c3c",
|
||||
"negativeFillColors": "#db4c3c",
|
||||
"useDataSetColors": false
|
||||
}],
|
||||
|
||||
"stockLegend": {
|
||||
"markerType": "none",
|
||||
"markerSize": 0,
|
||||
"labelText": "",
|
||||
"periodValueTextRegular": "[[value.close]]"
|
||||
},
|
||||
|
||||
"valueAxes": [{
|
||||
"usePrefixes": true
|
||||
}]
|
||||
}
|
||||
],
|
||||
|
||||
"listeners": [{
|
||||
"event": "dataUpdated",
|
||||
"method": function() {
|
||||
progressbar.hide();
|
||||
}
|
||||
}],
|
||||
|
||||
"panelsSettings": {
|
||||
"color": "#fff",
|
||||
"plotAreaFillColors": "#333",
|
||||
"plotAreaFillAlphas": 1,
|
||||
"marginLeft": 60,
|
||||
"marginTop": 5,
|
||||
"marginBottom": 5
|
||||
},
|
||||
|
||||
"chartScrollbarSettings": {
|
||||
"graph": "g1",
|
||||
"graphType": "line",
|
||||
"usePeriod": "WW",
|
||||
"backgroundColor": "#333",
|
||||
"graphFillColor": "#666",
|
||||
"graphFillAlpha": 0.5,
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1,
|
||||
"selectedBackgroundColor": "#444",
|
||||
"selectedGraphFillAlpha": 1
|
||||
},
|
||||
|
||||
"categoryAxesSettings": {
|
||||
"equalSpacing": true,
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1
|
||||
},
|
||||
|
||||
"valueAxesSettings": {
|
||||
"gridColor": "#555",
|
||||
"gridAlpha": 1,
|
||||
"inside": false,
|
||||
"showLastLabel": true
|
||||
},
|
||||
|
||||
"chartCursorSettings": {
|
||||
"pan": true,
|
||||
"valueLineEnabled": true,
|
||||
"valueLineBalloonEnabled": true
|
||||
},
|
||||
|
||||
"legendSettings": {
|
||||
"color": "#fff"
|
||||
},
|
||||
|
||||
"stockEventsSettings": {
|
||||
"showAt": "high",
|
||||
"type": "pin"
|
||||
},
|
||||
|
||||
"balloon": {
|
||||
"textAlign": "left",
|
||||
"offsetY": 10
|
||||
},
|
||||
|
||||
"periodSelector": {
|
||||
"position": "bottom",
|
||||
"periods": [{
|
||||
"period": "DD",
|
||||
"count": 10,
|
||||
"label": "10D"
|
||||
}, {
|
||||
"period": "MM",
|
||||
"count": 1,
|
||||
"label": "1M"
|
||||
}, {
|
||||
"period": "MM",
|
||||
"count": 6,
|
||||
"label": "6M"
|
||||
}, {
|
||||
"period": "YYYY",
|
||||
"count": 1,
|
||||
"label": "1Y"
|
||||
}, {
|
||||
"period": "YYYY",
|
||||
"count": 2,
|
||||
"selected": true,
|
||||
"label": "2Y"
|
||||
}, {
|
||||
"period": "YTD",
|
||||
"label": "YTD"
|
||||
}, {
|
||||
"period": "MAX",
|
||||
"label": "MAX"
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
||||
var progressbar, progressLabel;
|
||||
function udpateProgress( totalPercent, filePercent, url ) {
|
||||
|
||||
// initialize progress bar
|
||||
if ( progressbar === undefined ) {
|
||||
progressbar = $( "#progressbar" ).show();
|
||||
progressLabel = $( ".progress-label" );
|
||||
progressbar.progressbar( {
|
||||
value: false,
|
||||
change: function() {
|
||||
progressLabel.text( progressbar.progressbar( "value" ) + "%" );
|
||||
},
|
||||
complete: function() {
|
||||
progressLabel.text( "100%" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// update value
|
||||
progressbar.progressbar( "value", totalPercent );
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="chartcontainer">
|
||||
<div id="chartdiv"></div>
|
||||
<div id="progressbar" style="display: none;"><div class="progress-label">...</div></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
2
web/js/amcharts/plugins/dataloader/index.js
Normal file
2
web/js/amcharts/plugins/dataloader/index.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("amcharts3/amcharts/amcharts.js");
|
||||
require("./dataloader.min.js");
|
6
web/js/amcharts/plugins/dataloader/lang/cs.js
Normal file
6
web/js/amcharts/plugins/dataloader/lang/cs.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
AmCharts.translations.dataLoader.cs = {
|
||||
'Error loading the file': 'Došlo k chybě při načítání souboru',
|
||||
'Error parsing JSON file': 'Chyba při zpracování JSON souboru',
|
||||
'Unsupported data format': 'Nepodporovaný formát souboru',
|
||||
'Loading data...': 'Načítám data...'
|
||||
}
|
6
web/js/amcharts/plugins/dataloader/lang/en.js
Normal file
6
web/js/amcharts/plugins/dataloader/lang/en.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
AmCharts.translations.dataLoader.en = {
|
||||
'Error loading the file': 'Error loading the file',
|
||||
'Error parsing JSON file': 'Error parsing JSON file',
|
||||
'Unsupported data format': 'Unsupported data format',
|
||||
'Loading data...': 'Loading data...'
|
||||
}
|
6
web/js/amcharts/plugins/dataloader/lang/fr.js
Normal file
6
web/js/amcharts/plugins/dataloader/lang/fr.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
AmCharts.translations.dataLoader.fr = {
|
||||
'Error loading the file': 'Erreur lors du chargement du fichier',
|
||||
'Error parsing JSON file': 'Erreur lors de l\'analyse du fichier JSON',
|
||||
'Unsupported data format': 'Le format des données n\'est pas supporté',
|
||||
'Loading data...': 'Chargement des données...'
|
||||
}
|
6
web/js/amcharts/plugins/dataloader/lang/lt.js
Normal file
6
web/js/amcharts/plugins/dataloader/lang/lt.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
AmCharts.translations.dataLoader.lt = {
|
||||
'Error loading the file': 'Nepavyko užkrauti failo',
|
||||
'Error parsing JSON file': 'Skaitant JSON failą įvyko klaida',
|
||||
'Unsupported data format': 'Nepalaikomas duomenų formatas',
|
||||
'Loading data...': 'Kraunami duomenys...'
|
||||
}
|
201
web/js/amcharts/plugins/dataloader/license.txt
Normal file
201
web/js/amcharts/plugins/dataloader/license.txt
Normal file
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
10
web/js/amcharts/plugins/dataloader/package.json
Normal file
10
web/js/amcharts/plugins/dataloader/package.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "amcharts3-dataloader",
|
||||
"version": "1.0.16",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/amcharts/dataloader.git"
|
||||
}
|
||||
}
|
425
web/js/amcharts/plugins/dataloader/readme.md
Normal file
425
web/js/amcharts/plugins/dataloader/readme.md
Normal file
|
@ -0,0 +1,425 @@
|
|||
# amCharts Data Loader
|
||||
|
||||
Version: 1.0.16
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
By default all amCharts libraries accept data in JSON format. It needs to be
|
||||
there when the web page loads, defined in-line or loaded via custom code.
|
||||
|
||||
This plugin introduces are native wrapper that enables automatic loading of data
|
||||
from external data data sources in CSV and JSON formats.
|
||||
|
||||
Most of the times you will just need to provide a URL of the external data
|
||||
source - static file or dynamically generated - and it will do the rest.
|
||||
|
||||
|
||||
## Important notice
|
||||
|
||||
Due to security measures implemented in most of the browsers, the external data
|
||||
loader will work only when the page with the chart or map is loaded via web
|
||||
server.
|
||||
|
||||
So, any of the examples loaded locally (file:///) will not work.
|
||||
|
||||
The page needs to be loaded via web server (http://) in order to work properly.
|
||||
|
||||
Loading data from another domain than the web page is loaded is possible but is
|
||||
a subject for `Access-Control-Allow-Origin` policies defined by the web server
|
||||
you are loading data from.
|
||||
|
||||
For more about loading data across domains use the following thread:
|
||||
http://stackoverflow.com/questions/1653308/access-control-allow-origin-multiple-origin-domains
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### 1) Include the minified version of file of this plugin. I.e.:
|
||||
|
||||
```
|
||||
<script src="amcharts/plugins/dataloader/dataloader.min.js" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
(this needs to go after all the other amCharts includes)
|
||||
|
||||
### 2) Add data source properties to your chart configuration.
|
||||
|
||||
Regular (Serial, Pie, etc.) charts:
|
||||
|
||||
```
|
||||
AmCharts.makeChart( "chartdiv", {
|
||||
...,
|
||||
"dataLoader": {
|
||||
"url": "data.json",
|
||||
"format": "json"
|
||||
}
|
||||
} );
|
||||
```
|
||||
|
||||
Stock chart:
|
||||
|
||||
```
|
||||
AmCharts.makeChart( "chartdiv", {
|
||||
...,
|
||||
"dataSets": [{
|
||||
...,
|
||||
"dataLoader": {
|
||||
"url": "data.csv",
|
||||
"format": "csv",
|
||||
"delimiter": ",", // column separator
|
||||
"useColumnNames": true, // use first row for column names
|
||||
"skip": 1 // skip header row
|
||||
}
|
||||
}]
|
||||
} );
|
||||
```
|
||||
|
||||
That's it. The plugin will make sure the files are loaded and dataProvider is
|
||||
populated with their content *before* the chart is built.
|
||||
|
||||
Some formats, like CSV, will require additional parameters needed to parse the
|
||||
data, such as "separator".
|
||||
|
||||
If the "format" is omitted, the plugin will assume JSON.
|
||||
|
||||
### Using in object-based chart setup
|
||||
|
||||
If you’re still using object-based chart setup, assign dataLoader-related config object to chart object’s `dataLoader` property:
|
||||
|
||||
```
|
||||
var chart = new AmCharts.AmSerialChart();
|
||||
...
|
||||
chart["dataLoader"] = {
|
||||
"url": "data.csv",
|
||||
"format": "csv",
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true,
|
||||
"skip": 1
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
## Complete list of available dataLoader settings
|
||||
|
||||
Property | Default | Description
|
||||
-------- | ------- | -----------
|
||||
async | true | If set to false (not recommended) everything will wait until data is fully loaded
|
||||
complete | | Callback function to execute when loader is done
|
||||
delimiter | , | [CSV only] a delimiter for columns (use \t for tab delimiters)
|
||||
emptyAs | undefined | [CSV only] replace empty columns with whatever is set here
|
||||
error | | Callback function to execute if file load fails
|
||||
init | | Callback function to execute when Data Loader is initialized, before any loading starts
|
||||
format | json | Type of data: json, csv
|
||||
headers | | An array of objects with two properties (key and value) to attach to HTTP request
|
||||
load | | Callback function to execute when file is successfully loaded (might be invoked multiple times)
|
||||
noStyles | false | If set to true no styles will be applied to "Data loading" curtain
|
||||
numberFields | | [CSV only] An array of fields in data to treat as numbers
|
||||
postProcess | | If set to function reference, that function will be called to "post-process" loaded data before passing it on to chart. The handler function will receive two parameters: loaded data, Data Loader options
|
||||
progress | | Set this to function reference to track progress of the load. The function will be passed in three parameters: global progress, individual file progress, file URL.
|
||||
showErrors | true | Show loading errors in a chart curtain
|
||||
showCurtain | true| Show curtain over the chart area when loading data
|
||||
reload | 0 | Reload data every X seconds
|
||||
reverse | false | [CSV only] add data points in revers order
|
||||
skip | 0 | [CSV only] skip X first rows in data (includes first row if useColumnNames is used)
|
||||
skipEmpty | true | [CSV only] Ignore empty lines in data
|
||||
timestamp | false | Add current timestamp to data URLs (to avoid caching)
|
||||
useColumnNames | false | [CSV only] Use first row in data as column names when parsing
|
||||
|
||||
|
||||
## Using in JavaScript Stock Chart
|
||||
|
||||
In JavaScript Stock Chart it works exactly the same as in other chart types,
|
||||
with the exception that `dataLoader` is set as a property to the data set
|
||||
definition. I.e.:
|
||||
|
||||
```
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "stock",
|
||||
...
|
||||
"dataSets": [{
|
||||
"title": "MSFT",
|
||||
"fieldMappings": [{
|
||||
"fromField": "Open",
|
||||
"toField": "open"
|
||||
}, {
|
||||
"fromField": "High",
|
||||
"toField": "high"
|
||||
}, {
|
||||
"fromField": "Low",
|
||||
"toField": "low"
|
||||
}, {
|
||||
"fromField": "Close",
|
||||
"toField": "close"
|
||||
}, {
|
||||
"fromField": "Volume",
|
||||
"toField": "volume"
|
||||
}],
|
||||
"compared": false,
|
||||
"categoryField": "Date",
|
||||
"dataLoader": {
|
||||
"url": "data/MSFT.csv",
|
||||
"format": "csv",
|
||||
"showCurtain": true,
|
||||
"showErrors": true,
|
||||
"async": true,
|
||||
"reverse": true,
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
```
|
||||
|
||||
### Can I also load event data the same way?
|
||||
|
||||
Sure. You just add a `eventDataLoader` object to your data set. All the same
|
||||
settings apply.
|
||||
|
||||
|
||||
## Adding custom headers to HTTP requests
|
||||
|
||||
If you want to add additional headers to your data load HTTP requests, use
|
||||
"headers" array. Each header is an object with two keys: "key" and "value":
|
||||
|
||||
```
|
||||
"dataLoader": {
|
||||
"url": "data/serial.json",
|
||||
"format": "json",
|
||||
"headers": [{
|
||||
"key": "x-access-token",
|
||||
"value": "123456789"
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Manually triggering a reload of all data
|
||||
|
||||
Once chart is initialized, you can trigger the reload of all data manually by
|
||||
calling `chart.dataLoader.loadData()` function. (replace "chart" with the actual
|
||||
variable that holds reference to your chart object)
|
||||
|
||||
## Using callback functions
|
||||
|
||||
Data Loader can call your own function when certain event happens, like data
|
||||
loading is complete, error occurs, etc.
|
||||
|
||||
To set custom event handlers, use these config options:
|
||||
|
||||
* "complete"
|
||||
* "init"
|
||||
* "load"
|
||||
* "error"
|
||||
* "progress"
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
AmCharts.makeChart( "chartdiv", {
|
||||
...,
|
||||
"dataSets": [{
|
||||
...,
|
||||
"dataLoader": {
|
||||
"url": "data.json",
|
||||
"init": function ( options, chart ) {
|
||||
console.log( 'Loading started' );
|
||||
},
|
||||
"load": function ( options, chart ) {
|
||||
console.log( 'Loaded file: ' + options.url );
|
||||
},
|
||||
"complete": function ( chart ) {
|
||||
console.log( 'Woohoo! Finished loading' );
|
||||
},
|
||||
"error": function ( options, chart ) {
|
||||
console.log( 'Ummm something went wrong loading this file: ' + options.url );
|
||||
},
|
||||
"progress": function( totalPercent, filePercent, url ) {
|
||||
console.log( 'Total percent loaded: ' + Math.round( totalPercent ) );
|
||||
}
|
||||
}
|
||||
}]
|
||||
} );
|
||||
```
|
||||
|
||||
## Using Data Loader's standalone functions
|
||||
|
||||
Data Loader's load and parsing functions are available for external standalone use.
|
||||
|
||||
The three available functions are as follows:
|
||||
|
||||
Function | Parameters | Description
|
||||
-------- | ---------- | -----------
|
||||
AmCharts.loadFile() | url, options, callback | Loads the file and passes it into callback function (unparsed)
|
||||
AmCharts.parseCSV() | data, options | Parses data in string CSV format and returns JavaScript Array
|
||||
AmCharts.parseJSON() | data | Parses data in string JSON format and returns JavaScript Array
|
||||
|
||||
The options passed into standalone functions are the same as discussed in [Complete list of available dataLoader settings](#complete-list-of-available-dataloader-settings) chapter.
|
||||
|
||||
### JSON Example
|
||||
|
||||
```
|
||||
AmCharts.loadFile(dataset_url, {}, function(data) {
|
||||
var chartData = AmCharts.parseJSON(data);
|
||||
console.log(chartData); // this will output an array
|
||||
});
|
||||
```
|
||||
|
||||
### CSV Example
|
||||
|
||||
```
|
||||
AmCharts.loadFile(dataset_url, {}, function(data) {
|
||||
var chartData = AmCharts.parseCSV(data, {
|
||||
"delimiter": ",",
|
||||
"useColumnNames": true
|
||||
});
|
||||
console.log(chartData); // this will output an array
|
||||
});
|
||||
```
|
||||
|
||||
## Translating into other languages
|
||||
|
||||
Depending on configuration options the plugin will display a small number of
|
||||
text prompts, like 'Data loading...'.
|
||||
|
||||
Plugin will try matching chart's `language` property and display text prompts in
|
||||
a corresponding language. For that the plugin needs to have the translations.
|
||||
|
||||
Some of the plugin translations are in **lang** subdirectory. Simply include the
|
||||
one you need.
|
||||
|
||||
If there is no translation to your language readily available, just grab en.js,
|
||||
copy it and translate.
|
||||
|
||||
The structure is simple:
|
||||
|
||||
```
|
||||
'The phrase in English': 'Translation'
|
||||
```
|
||||
|
||||
The phrase in English must be left intact.
|
||||
|
||||
When you're done, you can include your language as a JavaScript file.
|
||||
|
||||
P.S. send us your translation so we can include it for the benefits of other
|
||||
users. Thanks!
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
This plugin requires at least 3.13 version of JavaScript Charts, JavaScript
|
||||
Stock Chart or JavaScript Maps.
|
||||
|
||||
|
||||
## Demos
|
||||
|
||||
They're all in subdirectory /examples.
|
||||
|
||||
|
||||
## Extending this plugin
|
||||
|
||||
You're encouraged to modify, extend and make derivative plugins out of this
|
||||
plugin.
|
||||
|
||||
You can modify files, included in this archive or, better yet, fork this project
|
||||
on GitHub:
|
||||
|
||||
https://github.com/amcharts/dataloader
|
||||
|
||||
We're curious types. Please let us know (contact@amcharts.com) if you do create
|
||||
something new out of this plugin.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This plugin is licensed under Apache License 2.0.
|
||||
|
||||
This basically means you're free to use or modify this plugin, even make your
|
||||
own versions or completely different products out of it.
|
||||
|
||||
Please see attached file "license.txt" for the complete license or online here:
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
|
||||
## Contact us
|
||||
|
||||
* Email:contact@amcharts.com
|
||||
* Web: http://www.amcharts.com/
|
||||
* Facebook: https://www.facebook.com/amcharts
|
||||
* Twitter: https://twitter.com/amcharts
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.0.16
|
||||
* Added "numberFields" config array
|
||||
|
||||
### 1.0.15
|
||||
* Added "emptyAs" config property. Empty CSV values will be set to this (default `undefined`)
|
||||
|
||||
### 1.0.14
|
||||
* Added "init" event handler, which is called **before** loading starts
|
||||
|
||||
### 1.0.13
|
||||
* Added "progress" handler, which can be used to monitor data load progress
|
||||
|
||||
### 1.0.12
|
||||
* Better default options handling in external calls to AmCharts.loadFile
|
||||
* Fixed the latest version of Stock Chart not resetting to default pre-defined period
|
||||
* New example: Using Data Loader functions externally (map_json_external_function.html)
|
||||
|
||||
### 1.0.11
|
||||
* New translation: Added French translation. Thanks Remy!
|
||||
* Tweaks to allow better animation after data load on Pie chart
|
||||
|
||||
### 1.0.10
|
||||
* Fixed error related to headers not being set when using standalone data load functions
|
||||
|
||||
### 1.0.9
|
||||
* Plugin will now ignore empty CSV lines by default (configurable with `skipEmpty` property)
|
||||
|
||||
### 1.0.8
|
||||
* Added `headers` config variable which allows adding custom headers to HTTP requests
|
||||
|
||||
### 1.0.7
|
||||
* Fixed an issue with the Pie chart when it is being loaded in inactive tab
|
||||
|
||||
### 1.0.6
|
||||
* Added support for Gauge chart (loads `arrows` array)
|
||||
|
||||
### 1.0.5
|
||||
* Fixed JS error if periodSelector was not defined in chart config
|
||||
* Now all callback functions (complete, error, load) receive additional parameter: chart
|
||||
* postProcess function will now have "this" context set to Data Loader object as well as receive chart reference as third paramater
|
||||
|
||||
### 1.0.4
|
||||
* Added `chart.dataLoader.loadData()` function which can be used to manually trigger all data reload
|
||||
|
||||
### 1.0.3
|
||||
* Fixed the bug where defaults were not being applied properly
|
||||
* Fixed the bug with translations not being applied properly
|
||||
* Cleaned up the code (to pass JSHint validation)
|
||||
|
||||
### 1.0.2
|
||||
* Fixed the issue with modified Array prototypes
|
||||
|
||||
### 1.0.1
|
||||
* Added `complete`, `load` and `error` properties that can be set with function handlers to be invoked on load completion, successful file load or failed load respectively
|
||||
* Fixed language container initialization bug
|
||||
* Fixed bug that was causing parse errors not be displayed
|
||||
|
||||
### 1.0
|
||||
* Added GANTT chart support
|
||||
|
||||
### 0.9.2
|
||||
* Added global data load methods that can be used to load and parse data by code outside plugin
|
||||
* Trim CSV column names
|
||||
* Translation added: Lithuanian
|
||||
|
||||
### 0.9.1
|
||||
* Fix chart animations not playing after asynchronous load
|
||||
|
||||
### 0.9
|
||||
* Initial release
|
Loading…
Add table
Add a link
Reference in a new issue