Published
Edited
May 25, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
chapterDistribution = cDistribution
Insert cell
Insert cell
Insert cell
heatData = {
const data = d3.csvParse(await FileAttachment("teotw-chapter-pov@2.csv").text(), ({character, chapter_abbr, chapter_order, chapter, word_count}) => ({character, chapter, chapter_abbr, chapter_order: +chapter_order, word_count: +word_count}))
const names = [... new Set(data.map(({character}) => character))];
const values = []
const [firstChapter, lastChapter] = d3.extent(data, d => d.chapter_order)
const chapters = d3.range(firstChapter, lastChapter + 1);
const chapterNames = chapters.map(chapterOrder => data.find(d => d.chapter_order === chapterOrder).chapter);
for (const pov of data) {
const idx = names.findIndex(name => name === pov.character);
(values[idx] || (values[idx] = new Array(chapters.length).fill(0)))[pov.chapter_order - firstChapter] += pov.word_count;
}
return {
names,
values,
chapters,
chapterNames,
chapter_divisor: 30,
firstChapter
};
}
Insert cell
import {lgd as hLegend, tooltip as tt, chart as hChart} with {heatData as data}from "@dunderdan/heatmap-wot-chapter-pov/2"
Insert cell
Insert cell
Insert cell
ttHTML = tt
Insert cell
dataPOVSum = await FileAttachment('pov-character-sum.json').json()
Insert cell
import {chart as povcs} with {dataPOVSum as data} from "@dunderdan/character-pov-distribution"
Insert cell
povCharSum = povcs
Insert cell
Insert cell
dataSankey = Object.assign(d3.csvParse(await FileAttachment('teotw-chapter-pov.csv').text(), ({chapter, chapter_order, chapter_abbr, word_count, character}) => {
return {
chapter: chapter_abbr,
chapterComplete: chapter,
pages: +word_count,
narrator: character
}
}), {columns: ['chapter', 'narrator', 'pages']})
Insert cell
Insert cell
sankeyDiagram = sDiagram
Insert cell
md`## Gender POV`
Insert cell
import { chart as geChart } from "@dunderdan/gender-pov-distribution"
Insert cell
genderChart = geChart
Insert cell
md`## Box Plot POV`
Insert cell
boxData = d3.csvParse(await FileAttachment("teotw-chapter-pov@2.csv").text(), ({character, word_count, gender, chapter, nationality}) => ({x: character, y: +word_count, gender, nationality, chapter}))
Insert cell
import {chart as bpChart} with {boxData as data} from "@dunderdan/box-plot-wheel-of-time-chapter-length"
Insert cell
boxPlotChart = bpChart
Insert cell
md`## Scatter`
Insert cell
dataSourceScatter = await FileAttachment("teotw-chapter-pov@2.csv").text()
Insert cell
import {chart as stChart, viewof xAttribute as xA, viewof yAttribute as yA,viewof aAttribute as aA, upt as stUpt} with {dataSourceScatter as dataSource} from "@dunderdan/scatterplot-number-povs"
Insert cell
xAtr = viewof xA
Insert cell
yAtr = viewof yA
Insert cell
aAtr = viewof aA
Insert cell
scatterChart = stChart
Insert cell
updateScatter = stUpt
Insert cell
md`## Bar Race`
Insert cell
import {chart as rcChart, viewof colorChoice as cChoice, viewof replay as rpl} from "@dunderdan/wheel-of-time-bar-chart-race"
Insert cell
colorChoice = viewof cChoice
Insert cell
replay = viewof rpl
Insert cell
race = rcChart
Insert cell
md`## POV Co-occurrences`
Insert cell
import {chart as pcChart, styles as gStyle} from "@dunderdan/povcooccurence-graph"
Insert cell
povCOChart = pcChart
Insert cell
grStyle = gStyle
Insert cell
dataChapterCoocur = FileAttachment("chapter-cooccurrence.json").json()
Insert cell
import { chart as chChart} with {dataChapterCoocur as data} from "@dunderdan/chapter-cooccurence-graph"
Insert cell
chapterCOChart = chChart
Insert cell
import {chart as links, viewof order as orderLinks} with {dataChapterCoocur as data} from "@dunderdan/chapter-interaction-arc-diagram"
Insert cell
Insert cell
cooccur = links
Insert cell
md`## Icon Charts`
Insert cell
import {drawDonut, viewof characterPOV as cPOV, chartFromPOV as charToIcon} from "@dunderdan/icon-distribution"
Insert cell
iconChart = {
yield html`
<div id="chartIcons">
</div>`;
drawDonut();
}
Insert cell
iconToCharChart = {
yield html`
<div id="chartPerCharacter">
</div>`;
}
Insert cell
characterSelectorIcon = viewof cPOV
Insert cell
charToIconChart = charToIcon
Insert cell
md`## Concepts Word Cloud`
Insert cell
conceptDivider = 1
Insert cell
conceptData = FileAttachment("concepts.json").json()
Insert cell
import {chart as cptChart} with {conceptData as dataSource, conceptDivider as divider} from "@dunderdan/word-cloud"
Insert cell
conceptChart = cptChart
Insert cell
import {teotwColorPalette as coverPalette, style as paletteSt} from "@dunderdan/wot-color-palette"
Insert cell
teotwCoverPalette = coverPalette
Insert cell
paletteStyle = paletteSt
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more