Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Moved around in the project and fix a minor sortingbug for multiDims.…
Browse files Browse the repository at this point in the history
… Also fixed so linechart dont need 2 measures
  • Loading branch information
yoohahn committed Sep 24, 2015
1 parent 3161e75 commit 506a484
Show file tree
Hide file tree
Showing 31 changed files with 28 additions and 58 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
/node_modules/
Chart.min.js
Chart.js
**/external/*
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ Render Chart.JS charts in Qlik Sense

## Install
* bower install
* copy Chart.js from bower_component into externals folder for the chart.
* copy all files from common into externals folder for the chart.
* copy Chart.js from bower_component into charts-folder/externals.

## TODO
Automate the installation steps.
Automate the installation step above.

## Preview
![All Charts](/images/all.png?raw=true "All Charts")
2 changes: 1 addition & 1 deletion bar/bar.js → charts-folder/bar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define( [
'jquery',
'./props',
'./props-bar',
'./external/load-externals'
], function ( $, props, externals ) {
'use strict';
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 10 additions & 6 deletions common/chart-util.js → charts-folder/external/chart-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ define( [
},
sortSimple: function ( list, name, revers, multiMeasure ) {
list = list.sort( function ( a, b ) {
var sortA = a[ name ],
sortB = b[ name ];
var sortA = a[ name[ 0 ] ],
sortB = b[ name[ 0 ] ];
if ( multiMeasure ) {
sortA = a[ 0 ][ name ];
sortB = b[ 0 ][ name ];
sortA = a[ 0 ][ name[ 0 ] ];
sortB = b[ 0 ][ name[ 0 ] ];
if ( isNaN( sortA ) ) {
sortA = a[ 0 ][ name[ 1 ] ];
sortB = b[ 0 ][ name[ 1 ] ];
}
}
return sortA - sortB;
} );
Expand Down Expand Up @@ -88,7 +92,7 @@ define( [
}
}

return self.sortSimple( data, 'value', true );
return self.sortSimple( data, [ 'value' ], true );
},
prepMultiMeasureCharts: function prepData( layout, round ) {
var data = [];
Expand All @@ -104,7 +108,7 @@ define( [
qMatrix = layout.qHyperCube.qDataPages[ 0 ].qMatrix,
len = qMatrix.length,
dataSetLen = qMatrix[ 0 ].length - 1,
list = self.sortSimple( qMatrix, 'qNum', true, true );
list = self.sortSimple( qMatrix, [ 'qNum', 'qElemNumber' ], true, true );

data.labels = [];
data.datasets = [];
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion line/line.js → charts-folder/line.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define( [
'jquery',
'./props',
'./props-line',
'./external/load-externals'
], function ( $, props, externals ) {
'use strict';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pie/pie.js → charts-folder/pie.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define( [
'jquery',
'./props',
'./props-pie',
'./external/load-externals'
], function ( $, props, externals ) {
'use strict';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion polar/polar.js → charts-folder/polar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define( [
'jquery',
'./props',
'./props-polar',
'./external/load-externals'
], function ( $, props, externals ) {
'use strict';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion line/props.js → charts-folder/props-radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define( [], function () {
},
measures = {
uses: "measures",
min: 2,
min: 1,
max: 2
},
sorting = {
Expand Down
2 changes: 1 addition & 1 deletion radar/radar.js → charts-folder/radar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define( [
'jquery',
'./props',
'./props-radar',
'./external/load-externals'
], function ( $, props, externals ) {
'use strict';
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions charts-folder/wbfolder.wbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
bar.js;
bar.qext
line.js;
line.qext
pie.js;
pie.qext
polar.js;
polar.qext
radar.js;
radar.qext
10 changes: 0 additions & 10 deletions line/external/load-externals.js

This file was deleted.

10 changes: 0 additions & 10 deletions pie/external/load-externals.js

This file was deleted.

2 changes: 0 additions & 2 deletions pie/wbfolder.wbl

This file was deleted.

10 changes: 0 additions & 10 deletions polar/external/load-externals.js

This file was deleted.

10 changes: 0 additions & 10 deletions radar/external/load-externals.js

This file was deleted.

0 comments on commit 506a484

Please sign in to comment.