This is a data visualization plugin for Obsidian, based on Ant Design Charts.
- Obsidian Charts View Plugin
Use command Insert Template...
-> Word Count
to insert code block.
#-----------------#
#- chart type -#
#-----------------#
type: WordCloud
#-----------------#
#- chart data -#
#-----------------#
data: "wordcount:Words"
#-----------------#
#- chart options -#
#-----------------#
options:
wordField: "word"
weightField: "count"
colorField: "count"
wordStyle:
rotation: 30
Use command Insert Template
-> Pie
to insert code block.
Use command Insert Template...
-> WordCloud
to insert code block.
Use command Insert Template...
-> Treemap
to insert code block.
Use command Insert Template...
-> DualAxes
to insert code block.
Use data.<any name>
and options.<any name>
to set data and options. Keep data and options <any name>
same.
Use command Insert Template...
-> Mix
to insert code block.
Use command Insert Template...
-> Bar
to insert code block.
Use command Insert Template...
-> OrganizationTreeGraph
to insert code block.
Use command Insert Template...
-> Radar
to insert code block.
Use command Insert Template...
-> TinyLine
to insert code block.
Chart data by dataviewjs.
Use command Insert Template...
-> Dataviewjs Example (Column)
to insert code block.
Use command Import data from external CSV file
to insert data from CSV file.
Load CSV file from data path. Data path should be specified in settings.
#-----------------#
#- chart type -#
#-----------------#
type: Mix
#-----------------#
#- chart data -#
#-----------------#
data.area:
- time: 1246406400000
temperature: [14.3, 27.7]
- time: 1246492800000
temperature: [14.5, 27.8]
- time: 1246579200000
temperature: [15.5, 29.6]
- time: 1246665600000
temperature: [16.7, 30.7]
- time: 1246752000000
temperature: [16.5, 25.0]
- time: 1246838400000
temperature: [17.8, 25.7]
data.line: LineData.csv
#-----------------#
#- chart options -#
#-----------------#
options:
appendPadding: 8
syncViewPadding: true
tooltip:
shared: true
showMarkers: false
showCrosshairs: true
offsetY: -50
options.area:
axes: {}
meta:
time:
type: 'time'
mask: 'MM-DD'
nice: true
tickInterval: 172800000
range: [0, 1]
temperature:
nice: true
sync: true
alias: '温度范围'
geometries:
- type: 'area'
xField: 'time'
yField: 'temperature'
mapping: {}
options.line:
axes: false
meta:
time:
type: 'time'
mask: 'MM-DD'
nice: true
tickInterval: 172800000
range: [0, 1]
temperature:
sync: 'temperature'
alias: '温度'
geometries:
- type: 'line'
xField: 'time'
yField: 'temperature'
mapping: {}
- type: 'point'
xField: 'time'
yField: 'temperature'
mapping:
shape: 'circle'
style:
fillOpacity: 1
#-----------------#
#- chart type -#
#-----------------#
type: DualAxes
#-----------------#
#- chart data -#
#-----------------#
data: DualAxesData.csv, DualAxesData.csv
#-----------------#
#- chart options -#
#-----------------#
options:
xField: 'time'
yField: ['value', 'count']
yAxis:
value:
min: 0
label:
formatter:
function formatter(val) {
return ''.concat(val, '个');
}
geometryOptions:
- geometry: 'column'
- geometry: 'line'
lineStyle:
lineWidth: 2
#-----------------#
#- chart data -#
#-----------------#
data: |
dataviewjs:
return dv.pages()
.groupBy(p => p.file.folder)
.map(p => ({folder: p.key || "ROOT", count: p.rows.length}))
.array();
#-----------------#
#- chart data -#
#-----------------#
data: |
dataviewjs:
return dv.pages()
.groupBy(p => p.file.ctime.hour >= 8 && p.file.ctime.hour <= 18 ? 'Day' : 'Night')
.map(p => ({cdate: p.key, count: p.rows.length}))
.array();
#-----------------#
#- chart data -#
#-----------------#
data: |
dataviewjs:
return dv.pages()
.groupBy(p => p.file.ctime.toFormat("HH"))
.map(p => ({cdate: p.key, count: p.rows.length}))
.array();
#-----------------#
#- chart data -#
#-----------------#
data: |
dataviewjs:
return dv.pages()
.groupBy(p => p.file.cday.toFormat("yyyy/MM"))
.map(p => ({cdate: p.key, count: p.rows.length}))
.array();
- dv.current()
- dv.pages(source)
- dv.pagePaths(source)
- dv.page(path)
- dv.array(value)
- dv.isArray(value)
- dv.date(text)
- dv.fileLink(path, [embed?], [display-name])
See Dataview Codeblock Reference
- Copy over
main.js
,styles.css
,manifest.json
to your vaultVaultFolder/.obsidian/plugins/obsidian-chartsview-plugin/
.