Skip to content

Commit

Permalink
added two ordino datasets to showcase the canvas overview renderer, for
Browse files Browse the repository at this point in the history
  • Loading branch information
domdir committed Sep 7, 2018
1 parent ce1d50d commit 827a05c
Show file tree
Hide file tree
Showing 9 changed files with 88,383 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {wur, shanghai} from './wur';
import forbes from './forbes-top-2000-companies';
import happiness from './world-happiness-report';
import soccer from './soccer';
import ordino1 from './ordino1';
import ordino2 from './ordino2';

export {IDataset} from './IDataset';
export {default as fromFile} from './fromFile';
Expand All @@ -12,7 +14,9 @@ export const data: IDataset[] = [
shanghai,
forbes,
happiness,
soccer
soccer,
ordino1,
ordino2
];

export default data;
Expand Down
85 changes: 85 additions & 0 deletions src/data/ordino1/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import {IDataset} from '../IDataset';
import {parse, ParseResult} from 'papaparse';
import {builder, buildRanking, buildStringColumn, buildCategoricalColumn, buildNumberColumn} from 'lineupjs';
import '!file-loader?name=preview.png!./soccer.png';

export const data: IDataset = {
id: 'ordino1',
title: 'Ordino 1',
image: './preview.png',
link: '',
description: `<p></p>`,
rawData: '',
buildScript(rawVariable: string, domVariable: string) {
return `
const parsed = Papa.parse(${rawVariable}, {
dynamicTyping: true,
header: true,
skipEmptyLines: true
});
//parsed.data.forEach((row) => {
// const suffix = [12, 13, 14, 15, 16, 17];
// const cols = ['games', 'goals', 'minutes', 'assists'];
// cols.forEach((col) => {
// row[col] = suffix.map((d) => !row[col + d] && row[col + d] !== 0 ? null : row[col + d]);
// });
//});
const lineup = LineUpJS.builder(parsed.data)//
.column(buildStringColumn('Symbol'))
.column(buildStringColumn('Ensembl'))
.column(buildStringColumn('Name'))
.column(buildNumberColumn('Chromosome', [0, NaN]))
.column(buildCategoricalColumn('Biotype'))
.column(buildNumberColumn('Relative Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Relative Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('numbers Relative Copy Number', [0, NaN]).asArray(4))
.deriveColors()
.ranking(buildRanking()
.supportTypes()
.allColumns()
)
.buildTaggle(${domVariable});
`;
},
build(node: HTMLElement) {
return import('raw-loader!./ordino1.csv').then((content: any) => {
const csv: string = content.default ? content.default : content;
this.rawData = csv;
return parse(csv, {
dynamicTyping: true,
header: true,
skipEmptyLines: true
});
}).then((parsed: ParseResult) => {
parsed.data.forEach((row) => {
const cols = ['numbers Relative Copy Number'];
cols.forEach((col) => {
row[col] = JSON.parse(row[col]);
});
});
return builder(parsed.data)
.column(buildStringColumn('Symbol'))
.column(buildStringColumn('Ensembl'))
.column(buildStringColumn('Name'))
.column(buildNumberColumn('Chromosome', [0, NaN]))
.column(buildCategoricalColumn('Biotype'))
.column(buildNumberColumn('Relative Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Relative Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('numbers Relative Copy Number', [0, NaN]).asArray(4))
.deriveColors()
.ranking(buildRanking()
.supportTypes()
.allColumns()
)
.buildTaggle(node);
});
}
};

export default data;
31,556 changes: 31,556 additions & 0 deletions src/data/ordino1/ordino1.csv

Large diffs are not rendered by default.

Binary file added src/data/ordino1/soccer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions src/data/ordino2/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {IDataset} from '../IDataset';
import {parse, ParseResult} from 'papaparse';
import {builder, buildRanking, buildStringColumn, buildCategoricalColumn, buildNumberColumn} from 'lineupjs';
import '!file-loader?name=preview.png!./soccer.png';

export const data: IDataset = {
id: 'ordino2',
title: 'Ordino 2',
image: './preview.png',
link: '',
description: `<p></p>`,
rawData: '',
buildScript(rawVariable: string, domVariable: string) {
return `
const parsed = Papa.parse(${rawVariable}, {
dynamicTyping: true,
header: true,
skipEmptyLines: true
});
//parsed.data.forEach((row) => {
// const suffix = [12, 13, 14, 15, 16, 17];
// const cols = ['games', 'goals', 'minutes', 'assists'];
// cols.forEach((col) => {
// row[col] = suffix.map((d) => !row[col + d] && row[col + d] !== 0 ? null : row[col + d]);
// });
//});
const lineup = LineUpJS.builder(parsed.data)//
.column(buildStringColumn('Symbol'))
.column(buildStringColumn('Ensembl'))
.column(buildStringColumn('Name'))
.column(buildNumberColumn('Chromosome', [0, NaN]))
.column(buildCategoricalColumn('Biotype'))
.column(buildNumberColumn('Relative Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Relative Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('numbers Relative Copy Number', [0, NaN]).asArray(4))
.deriveColors()
.ranking(buildRanking()
.supportTypes()
.allColumns()
)
.buildTaggle(${domVariable});
`;
},
build(node: HTMLElement) {
return import('raw-loader!./ordino2.csv').then((content: any) => {
const csv: string = content.default ? content.default : content;
this.rawData = csv;
return parse(csv, {
dynamicTyping: true,
header: true,
skipEmptyLines: true
});
}).then((parsed: ParseResult) => {
parsed.data.forEach((row) => {
const cols = ['Relative Copy Number for Bladder', 'Relative Copy Number for Colon'];
cols.forEach((col) => {
row[col] = JSON.parse(row[col]);
});
});
return builder(parsed.data)
.column(buildStringColumn('Symbol'))
.column(buildStringColumn('Ensembl'))
.column(buildStringColumn('Name'))
.column(buildNumberColumn('Chromosome', [0, NaN]))
.column(buildCategoricalColumn('Biotype'))
.column(buildNumberColumn('Relative Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 59M', [0, NaN]))
.column(buildNumberColumn('Relative Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('Total Absolute Copy Number of 143B', [0, NaN]))
.column(buildNumberColumn('Relative Copy Number for Bladder', [0, NaN]).asArray(4))
.column(buildNumberColumn('Relative Copy Number for Colon', [0, NaN]).asArray(4))
.deriveColors()
.ranking(buildRanking()
.supportTypes()
.allColumns()
)
.buildTaggle(node);
});
}
};

export default data;
Loading

0 comments on commit 827a05c

Please sign in to comment.