Skip to content

Commit

Permalink
Added demos for the data module
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Apr 25, 2014
1 parent 394e368 commit f86676b
Show file tree
Hide file tree
Showing 20 changed files with 11,347 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@

<!-- This target is only run if there are unused variables. -->
<target name="lint" depends="do-lint" if="lint.variable.error">
<echo message="Warning: undefined or unused variables exist. Run 'start build/lintreport.html'."/>
<echo message="Warning: undefined or unused variables exist. Open 'build/lintreport.html' and search for 'Undefined variable' and 'Unused variable'."/>
</target>

<!-- Runs jslint on parts in order to make it easier to find the error by file and line number. -->
Expand Down
26 changes: 19 additions & 7 deletions js/modules/data.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
* - complete : Function(chartOptions)
* The callback that is evaluated when the data is finished loading, optionally from an
* external source, and parsed. The first argument passed is a finished chart options
* object, containing series and an xAxis with categories if applicable. Thise options
* can be extended with additional options and passed directly to the chart constructor.
* object, containing the series. Thise options
* can be extended with additional options and passed directly to the chart constructor. This is
* related to the parsed callback, that goes in at an earlier stage.
*
* - csv : String
* A comma delimited string to be parsed. Related options are startRow, endRow, startColumn
Expand Down Expand Up @@ -57,7 +58,9 @@
*
* - parsed : Function
* A callback function to access the parsed columns, the two-dimentional input data
* array directly, before they are interpreted into series data and categories.
* array directly, before they are interpreted into series data and categories. See also
* the complete callback, that goes in on a later stage where the raw columns are interpreted
* into a Highcharts option structure.
*
* - parseDate : Function
* A callback function to parse string representations of dates into JavaScript timestamps.
Expand Down Expand Up @@ -339,7 +342,7 @@
headerRow = null;
}
});
this.headerRow = 0;
this.headerRow = 0;
},

/**
Expand Down Expand Up @@ -576,18 +579,27 @@
// Extend Chart.init so that the Chart constructor accepts a new configuration
// option group, data.
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function (proceed, userOptions, callback) {
var chart = this;
var chart = this,
completeOption;

if (userOptions && userOptions.data) {
completeOption = userOptions.data.complete;
Highcharts.data(Highcharts.extend(userOptions.data, {
complete: function (dataOptions) {
var i, series;

if (completeOption) {
completeOption(dataOptions);
}

// Merge series configs
if (userOptions.hasOwnProperty('series')) {
if (typeof userOptions.series === 'object') {
each(userOptions.series, function (series, i) {
i = Math.max(userOptions.series.length, dataOptions.series.length);
while (i--) {
series = userOptions.series[i] || {};
userOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]);
});
}
} else { // Allow merging in dataOptions.series (#2856)
delete userOptions.series;
}
Expand Down
Loading

0 comments on commit f86676b

Please sign in to comment.