Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
88d0af2
docs: refactor area chart example
luucvanderzee Nov 25, 2020
23d4e5c
docs: refactor brush example
luucvanderzee Nov 25, 2020
da1cd5c
docs: refactor candlestick example (WIP)
luucvanderzee Nov 25, 2020
c50f479
_
luucvanderzee Nov 25, 2020
a94d99f
docs: refactor candlestick example
luucvanderzee Nov 25, 2020
dd8b18d
_
luucvanderzee Nov 25, 2020
5f4df5b
docs: refactor categorical dot example
luucvanderzee Nov 25, 2020
f9d9397
docs: refactor choropleth example
luucvanderzee Nov 25, 2020
7ffbcaa
docs: refactor second choropleth example
luucvanderzee Nov 25, 2020
e3314e0
docs: refactor density contours example
luucvanderzee Nov 25, 2020
2695f5f
docs: refactor donut example
luucvanderzee Nov 25, 2020
96179a3
docs: refactor gapminder example
luucvanderzee Nov 25, 2020
a64661f
docs: refactored area chart and candlestick again to use async IIFE (…
luucvanderzee Nov 25, 2020
d6b5361
docs: refactored heatmap example
luucvanderzee Nov 25, 2020
bf7cd5a
docs: refactor isotype example
luucvanderzee Nov 25, 2020
abf9e58
docs: refactor linked views example
luucvanderzee Nov 25, 2020
6ddc168
docs: refactor plain scatterplot example
luucvanderzee Nov 25, 2020
07145d6
docs: refactor population pyramid example
luucvanderzee Nov 25, 2020
eee62b1
docs: refactor scatterplot temp trends example (WIP)
luucvanderzee Nov 25, 2020
330f8f0
docs: refactor scatterplot temp trends example
luucvanderzee Nov 26, 2020
a0b9344
docs: refactor scatterplot transition example
luucvanderzee Nov 26, 2020
1c86947
docs: refactor stacked horizontal bars example
luucvanderzee Nov 26, 2020
531cc72
docs: refactor violin plot example
luucvanderzee Nov 26, 2020
686e8a5
docs: remove slice (too much hassle to implement now)
luucvanderzee Nov 26, 2020
9b410b8
docs: added styleguide for code in general and marks
luucvanderzee Nov 27, 2020
cd149d1
_
luucvanderzee Nov 27, 2020
20d8c9a
fix: update package-lock
atepoorthuis Nov 27, 2020
f5a03c5
Merge branch 'master' into improve-docs
luucvanderzee Nov 27, 2020
bf61e67
docs: rewrite point docs (WIP)
luucvanderzee Nov 27, 2020
27690ef
_
luucvanderzee Nov 27, 2020
160a452
docs: rewrote point doc
luucvanderzee Nov 27, 2020
38871b6
docs: rewrote label docs
luucvanderzee Nov 27, 2020
737657e
docs: rewrote symbol docs
luucvanderzee Nov 27, 2020
aca3d42
_
luucvanderzee Nov 27, 2020
a46c609
docs: rewrote line docs
luucvanderzee Nov 28, 2020
9b06065
docs: rewrote polygon docs (WIP)
luucvanderzee Nov 28, 2020
778ba71
fix: polygons now close automatically
luucvanderzee Nov 28, 2020
76859e5
docs: rewrote polygon docs
luucvanderzee Nov 28, 2020
da714f2
docs: rewrote rectangle docs
luucvanderzee Nov 28, 2020
cd8f5bf
docs: rewrote area docs
luucvanderzee Nov 28, 2020
3c0dd7e
docs: funcline (WIP)
luucvanderzee Nov 28, 2020
515e931
fix: funcline not working? (WIP) (no idea what's wrong here)
luucvanderzee Nov 28, 2020
fe1a574
_
luucvanderzee Nov 28, 2020
84ef337
fix: categorical dot example
luucvanderzee Nov 28, 2020
3789db9
_
luucvanderzee Nov 28, 2020
3225dcb
chore: remove closing logic to avoid merge conflict
luucvanderzee Nov 29, 2020
123633e
Merge branch 'master' into improve-docs
luucvanderzee Nov 29, 2020
57defbb
chore: upgrade florence
luucvanderzee Nov 29, 2020
00ce609
Merge branch 'master' into improve-docs
luucvanderzee Nov 29, 2020
dffe583
_
luucvanderzee Nov 29, 2020
66415f5
docs: funcline docs (still need to check if it looks good)
luucvanderzee Nov 29, 2020
801ea7c
fix: rollup config for repl functionality
atepoorthuis Nov 29, 2020
e95c8ba
Merge branch 'improve-docs' of gitlab.com:spatialnetworkslab/florence…
luucvanderzee Nov 29, 2020
8eaf8be
fix: remove sveltex inclusion from tailwind for now
atepoorthuis Nov 29, 2020
39277a8
Merge branch 'improve-docs' of gitlab.com:spatialnetworkslab/florence…
luucvanderzee Nov 29, 2020
8c79e03
_
luucvanderzee Nov 29, 2020
ede1c33
fix: async: use 'ready' variable
luucvanderzee Nov 29, 2020
b0cd7c3
docs: fixed donut example
luucvanderzee Nov 29, 2020
bdf9383
chore: compress pngs
atepoorthuis Nov 29, 2020
730dbdc
chore: update main repo deps
atepoorthuis Nov 29, 2020
44c8682
chore: update site deps and make compatible with new rollup plugin
atepoorthuis Nov 29, 2020
8b4b19e
feat: add cp examples 2-6 + 10
atepoorthuis Nov 30, 2020
2101b6a
fix: weird double clip path in graphic
luucvanderzee Nov 30, 2020
9a5e974
feat: clip props for Graphic and Section
luucvanderzee Nov 30, 2020
8d7f36e
feat: zoomIdentity can be specified easier
luucvanderzee Nov 30, 2020
39076d7
docs: fixed heatmap example
luucvanderzee Nov 30, 2020
bac7003
docs: fixed violin plot example
luucvanderzee Nov 30, 2020
70db03f
docs: article figure REPLs (code, thumbnails)
luucvanderzee Nov 30, 2020
d70eefc
docs: fix brush example
luucvanderzee Nov 30, 2020
2549732
docs: fix isotype example
luucvanderzee Nov 30, 2020
a13776a
docs: fix gapminder example
luucvanderzee Nov 30, 2020
8010811
fix: label rotate/clip bug
luucvanderzee Nov 30, 2020
b171096
_
luucvanderzee Nov 30, 2020
1d79504
_
luucvanderzee Nov 30, 2020
76de8bf
_
luucvanderzee Nov 30, 2020
0ac1a13
_
luucvanderzee Nov 30, 2020
521e691
_
luucvanderzee Nov 30, 2020
41eb267
fix: super weird bug in density contours
luucvanderzee Nov 30, 2020
b00fda2
docs: candlestick (removed semicolons)
luucvanderzee Dec 1, 2020
1fd3b74
candlestick: removed weird unnecessary log scale
luucvanderzee Dec 1, 2020
06ecf6b
candlestick: removed domains from global scope
luucvanderzee Dec 1, 2020
7465d72
candlestick: removed section
luucvanderzee Dec 1, 2020
658d840
candlestick: extracted weekdays to separate variable
luucvanderzee Dec 1, 2020
185565c
candlestick: removed nonsensical stroke logic
luucvanderzee Dec 1, 2020
9b22961
candlestick: replace variable names
luucvanderzee Dec 1, 2020
afa8dbf
candlestick: refactor into async IIFE
luucvanderzee Dec 1, 2020
78a4fc3
candelstick: improved csv typing stuff
luucvanderzee Dec 1, 2020
14e0cb9
candlestick: further improve readability
luucvanderzee Dec 1, 2020
c2882a2
docs: fixed candlestick example
luucvanderzee Dec 1, 2020
3e59774
docs: fix scatterplot temp trends example
luucvanderzee Dec 1, 2020
8f85084
docs: scatterplot temp trends (WIP)
luucvanderzee Dec 1, 2020
c9ecd34
fix: title clip
luucvanderzee Dec 1, 2020
e58caa6
docs: linked views (WIP)
luucvanderzee Dec 1, 2020
85ba82e
docs: added exaple texts to examples up until the dubois-one
luucvanderzee Dec 1, 2020
4a27075
docs: example text up to scatterplot transition
luucvanderzee Dec 1, 2020
b75e551
docs: improved all example texts
luucvanderzee Dec 1, 2020
50a745a
docs: added explanation of async IIFE
luucvanderzee Dec 1, 2020
13c8e38
docs: added transition, interaction and other props documentation (Area)
luucvanderzee Dec 1, 2020
7907561
docs: finished props for all marks
luucvanderzee Dec 1, 2020
ec3300c
docs: started on gridlines
luucvanderzee Dec 1, 2020
5ccbe42
docs: improved axis props
luucvanderzee Dec 1, 2020
f21b4c8
docs: examples for axes and gridlines
luucvanderzee Dec 1, 2020
aa9f7cb
docs: axes structure + fix link to grid lines
luucvanderzee Dec 1, 2020
ad19b04
docs: minor changes for consistency
luucvanderzee Dec 1, 2020
dfceff4
docs: clip prop
luucvanderzee Dec 1, 2020
9ffa299
_
luucvanderzee Dec 1, 2020
581a8fd
docs: rename name -> prop
luucvanderzee Dec 1, 2020
27d4aa5
docs: made grid and title props consistent
luucvanderzee Dec 1, 2020
3b411e3
docs: examples for graphic and section
luucvanderzee Dec 2, 2020
eb36f61
docs: gridlines
luucvanderzee Dec 2, 2020
6690303
docs: helpers (WIP)
luucvanderzee Dec 2, 2020
cc6faf8
_
luucvanderzee Dec 2, 2020
9f11ae3
_
luucvanderzee Dec 2, 2020
f6af8cb
docs: fix arrow in scaling diagram in local coordinates concept
luucvanderzee Dec 2, 2020
cfb4205
docs: local coordinates (made consistent)
luucvanderzee Dec 2, 2020
b9de376
docs: graphic viewBox
luucvanderzee Dec 2, 2020
9e534c3
docs: started on marks vs layers docs
luucvanderzee Dec 2, 2020
35fc8a1
docs: removed code highlighting local coords for now
luucvanderzee Dec 2, 2020
76aa56e
_
luucvanderzee Dec 2, 2020
f57810d
fix: restored weird viewBox behavior (my change broke the bar chart e…
luucvanderzee Dec 2, 2020
0f9bd43
_
luucvanderzee Dec 2, 2020
e0e3ede
docs: improved explanation grid
luucvanderzee Dec 2, 2020
36b0a6b
docs: improved axes documentation and fixed errors
luucvanderzee Dec 2, 2020
61df67c
chore: remove conflicting thumbnails for now
luucvanderzee Dec 2, 2020
84f8128
Merge branch 'master' into improve-docs
luucvanderzee Dec 2, 2020
3f4e4e5
fix: label related tests
atepoorthuis Dec 2, 2020
91fdea7
fix: postcss merge conflict
atepoorthuis Dec 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions site/examples/brush/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
$: {
let keys = Object.keys(selectedPoints)
if (keys.length > 0) {
averageA = keys.map(key => data.row(key).a).reduce((a, b) => a + b) / keys.length
averageB = keys.map(key => data.row(key).b).reduce((a, b) => a + b) / keys.length
averageA = keys.map(key => data.row({ key }).a).reduce((a, b) => a + b) / keys.length
averageB = keys.map(key => data.row({ key }).b).reduce((a, b) => a + b) / keys.length
} else {
averageA = undefined
averageB = undefined
Expand Down
73 changes: 42 additions & 31 deletions site/examples/candlestick/App.svelte
Original file line number Diff line number Diff line change
@@ -1,70 +1,81 @@
<script>
import { csv } from 'd3-fetch'
import { format } from 'd3-format'
import { autoType } from 'd3-dsv'
import { timeDay, timeMonday } from 'd3-time'
import { timeFormat } from 'd3-time-format'
import { timeParse, timeFormat } from 'd3-time-format'
import { scaleLog, scaleBand } from 'd3-scale'
import { Graphic, LineLayer, XAxis, YAxis } from '@snlab/florence'
import { Graphic, LineLayer, XAxis, YAxis, YGridLines } from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'

let appleStockData, scaleX, scaleY, ticksX, ready
const parseDate = timeParse('%Y-%m-%d')

let dataContainer, scaleX, scaleY, xTicks, ready

(async () => {
const data = await csv('/data/apple-stocks-candlestick.csv', autoType)
.slice(-120)

appleStockData = new DataContainer(data)
const data = await csv('/data/apple-stocks-candlestick.csv', d => ({
Date: parseDate(d.Date),
High: +d.High,
Low: +d.Low,
Open: +d.Open,
Close: +d.Close
}))

dataContainer = new DataContainer(data.slice(-120))
.mutate({
dates: row => [row.Date, row.Date],
lowHigh: row => [row.Low, row.High],
openClose: row => [row.Open, row.Close]
dates: r => [r.Date, r.Date],
lowHigh: r => [r.Low, r.High],
openClose: r => [r.Open, r.Close]
})

const noWeekend = d => d.getDay() !== 0 && d.getDay() !== 6
const domainDate = dataContainer.domain('Date')

scaleX = scaleBand().padding(0.2).domain(
timeDay().range(appleStockData.domain('date')).filter(noWeekend)
)
const weekdays = timeDay
.range(domainDate[0], +domainDate[1] + 1)
.filter(d => d.getDay() !== 0 && d.getDay() !== 6)

scaleX = scaleBand()
.domain(weekdays)
.padding(0.2)

scaleY = scaleLog().domain([
appleStockData.min('Low'),
appleStockData.max('High')
dataContainer.min('Low'),
dataContainer.max('High')
])

ticksX = timeMonday.every(1).range(domainDate[0], domainDate[1])
xTicks = timeMonday.every(2).range(...domainDate)

ready = true
})()

const openCloseColors = ([open, close]) => open > close ? '#da344d' : '#32936f'
</script>

{#if ready}

<Graphic
<Graphic
width={500}
height={500}
padding={{ top: 20, bottom: 30, left: 40, right: 30 }}
{scaleX}
{scaleX}
{scaleY}
padding={{ top: 20, bottom: 30, left: 40, right: 30 }}
flipY
>

<LineLayer
x={appleStockData.column('dates')}
y={appleStockData.column('lowHigh')}
<LineLayer
x={dataContainer.column('dates')}
y={dataContainer.column('lowHigh')}
strokeWidth={1}
/>

<LineLayer
x={appleStockData.column('dates')}
y={appleStockData.column('openClose')}
stroke={appleStockData.map('openClose', openCloseColors)}
x={dataContainer.column('dates')}
y={dataContainer.column('openClose')}
strokeWidth={4}
stroke={dataContainer.map('openClose', r => r[0] > r[1] ? '#da344d' : '#32936f') }
/>

<XAxis tickValues={ticksX} labelFormat={timeFormat('%-m/%-d')} baseLine={false} />
<XAxis tickValues={xTicks} labelFormat={timeFormat('%-m/%-d')} baseLine={false} />
<YAxis labelFormat={format('$d')} baseLine={false} />

<YGridLines />

</Graphic>

{/if}
26 changes: 19 additions & 7 deletions site/examples/choropleth-map/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,37 @@
} from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'

const COLORS = ['#d3d3d3', '#fff0d2', '#FDD1A5', '#FD9243', '#982f05', '#4e1802']
const COLORS = ['#fff0d2', '#FDD1A5', '#FD9243', '#982f05', '#4e1802']

let dataContainer, geoScales, priceColorScale, ready

(async () => {
const geojson = await json('/data/plan_areas_choropleth.json')
dataContainer = new DataContainer(geojson).dropNA('resale_price_sqm')
geoScales = createGeoScales(data.domain('$geometry'))
dataContainer = new DataContainer(geojson).mutate({
resale_price_sqm: r => r.resale_price_sqm === null ? undefined : r.resale_price_sqm
})
geoScales = createGeoScales(dataContainer.bbox())

priceColorScale = dataContainer.classify({
column: 'resale_price_sqm', method: 'Jenks', numClasses: COLORS.length
}, COLORS)
priceColorScale = dataContainer
.dropNA('resale_price_sqm')
.classify({
column: 'resale_price_sqm', method: 'EqualInterval', numClasses: 5
}, COLORS)
.unknown('#d3d3d3')

ready = true
})()
</script>

{#if ready}

<Graphic>
<Graphic
width={500}
height={500}
{...geoScales}
flipY
padding={30}
>

<Title
title={'Mean resale price per m2 (S$)'}
Expand All @@ -48,6 +59,7 @@
hjust={'right'}
flipLabels
usePadding={true}
format={Math.floor}
/>

</Graphic>
Expand Down
39 changes: 25 additions & 14 deletions site/examples/density-contours/App.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
<script>
import { tsv } from 'd3-fetch'
import { autoType } from 'd3-dsv'
import { contourDensity } from 'd3-contour'
import { scaleLinear } from 'd3-scale'
import { format } from 'd3-format'
import { Graphic, PointLayer, PolygonLayer, XAxis, YAxis } from '@snlab/florence'
import { Graphic, PolygonLayer, PointLayer, XAxis, YAxis } from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'

const width = 500
const height = 500

let dataContainer, contours, ready
let dataContainer, scaleX, scaleY, contours, ready

(async () => {
const data = await tsv('/data/eruptions.tsv')

const data = await tsv('/data/eruptions.tsv', autoType)
dataContainer = new DataContainer(data)

scaleX = scaleLinear()
.domain(dataContainer.domain('waiting'))
.nice()
.range([0, width])

scaleY = scaleLinear()
.domain(dataContainer.domain('eruptions'))
.nice()
.range([height, 0])

contours = contourDensity()
.x(d => scaleX(d.waiting))
.y(d => scaleY(d.eruptions))
.size([width, height])
.bandwidth(30)
.thresholds(30)(data)
Expand All @@ -25,12 +39,9 @@

{#if ready}

<Graphic
{width}
{height}
<Graphic
{width} {height}
padding={{ top: 20, right: 30, bottom: 30, left: 40 }}
scaleX={dataContainer.domain('waiting')}
scaleY={dataContainer.domain('eruptions')}
>

<PolygonLayer
Expand All @@ -41,14 +52,14 @@
/>

<PointLayer
x={dataContainer.column('waiting')}
y={dataContainer.column('eruptions')}
x={dataContainer.map('waiting', scaleX)}
y={dataContainer.map('eruptions', scaleY)}
radius={2}
/>

<XAxis baseLine={false} />
<YAxis baseLine={false} labelFormat={format('.1f')} />
<XAxis scale={scaleX} baseLine={false} />
<YAxis scale={scaleY} baseLine={false} labelFormat={format('.1f')} />

</Graphic>
</Graphic>

{/if}
2 changes: 1 addition & 1 deletion site/examples/gapminder/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.unknown('black')

ready = true
})
})()

setInterval(() => {
if (ready && currentYear < 2009) {
Expand Down
2 changes: 1 addition & 1 deletion site/examples/isotype/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.padding(0.01)

const colScale = scalePoint()
.domain(dataContainer.domain('col'))
.domain(Array(10).fill(0).map((_, i) => i + 1))
.padding(0.8)
.round(true)

Expand Down
23 changes: 13 additions & 10 deletions site/examples/linked-views/App.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import { scaleBand } from 'd3-scale'
import { json } from 'd3-fetch'
import { tick } from 'svelte'
import {
Graphic,
Section,
Expand Down Expand Up @@ -67,25 +68,25 @@
}

function onMouseout({ key }) {
if (hoverKey) hoverKey = undefined
hoverKey = undefined
heatmapData = undefined
}
</script>

{#if ready}

<Graphic width={1000} height={800}>
<Graphic width={500} height={800}>

<Section
x1={50} x2={475}
y1={50} y2={350}
y1={0} y2={400}
{...geoScales}
padding={25}
flipY
>

<PolygonLayer
geometry={geoData.column('$geometry')}
keys={geoData.keys()}
key={geoData.keys()}
fill={geoData.map('resale_price_sqm', priceColorScale)}
fillOpacity={({ key }) => hoverKey === key ? 1 : 0.5}
stroke={'white'}
Expand All @@ -95,7 +96,7 @@
transition={1000}
/>

<DiscreteLegend
<!-- <DiscreteLegend
fill={priceColorScale}
labelAnchorPoint={'r'}
title={'Ave. Resale Price/m2 (S$)'}
Expand All @@ -104,15 +105,14 @@
hjust={'right'}
flipLabels
usePadding={true}
/>
/> -->

</Section>

<Section
x1={50} x2={475}
y1={350} y2={650}
scaleY={yearScale}
y1={400} y2={800}
scaleX={monthScale}
scaleY={yearScale}
padding={50}
>

Expand All @@ -126,6 +126,9 @@
fill={heatmapData.map('resale_price_sqm', priceColorScale)}
/>

<XAxis flip vjust={'top'} baseLineOpacity={0} yOffset={3}/>
<YAxis baseLineOpacity={0} xOffset={3}/>

{/if}

<Title
Expand Down
2 changes: 1 addition & 1 deletion site/examples/population-pyramid/App.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { scaleLinear, scaleBand } from 'd3-scale'
import { Graphic, Section, RectangleLayer, XAxis, YAxis } from '@snlab/florence'
import { formatPrefix } from 'd3-format'
import { Graphic, Section, RectangleLayer, XAxis, YAxis } from '@snlab/florence'
import DataContainer from '@snlab/florence-datacontainer'
import { data } from './population.js'

Expand Down
9 changes: 5 additions & 4 deletions site/examples/scatterplot-temp-trends/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
valuesTo: 'value'
})
.mutate({
date: row => new Date(row.date, months.indexOf(row.month), 1),
date: row => new Date(+row.Year, months.indexOf(row.month), 1),
value: row => +row.value
})

scaleColor = scaleSequential()
.domain(dataContainer.domain('value').reverse())
.range(interpolateRdBu)
scaleColor = scaleSequential(interpolateRdBu).domain([
dataContainer.max('value'),
dataContainer.min('value')
])

ready = true
})()
Expand Down
2 changes: 1 addition & 1 deletion site/examples/stacked-area/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { autoType } from 'd3-dsv'
import { csv } from 'd3-fetch'
import { Graphic, AreaLayer, XAxis, YAxis } from '@snlab/florence'
import DataContainer from '@snlab/florene-datacontainer'
import DataContainer from '@snlab/florence-datacontainer'

let dataContainer, industries, scaleColor, ready

Expand Down
Loading