Giter VIP home page Giter VIP logo

obsidian-chartsview-plugin's Introduction

GitHub tag (latest SemVer) GitHub all releases GitHub Release Date GitHub last commit

Obsidian Charts View Plugin

This is a data visualization plugin for Obsidian, based on Ant Design Charts. Support plots and graphs.

Chart Templates

Word Count

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

image

Multi files

data: "wordcount:Words,PARA,@Inbox/"

ALL files

data: "wordcount:/"

Folder

data: "wordcount:@Inbox/"

Pie

Use command Insert Template -> Pie to insert code block.

image

WordCloud

Use command Insert Template... -> WordCloud to insert code block.

image

Treemap

Use command Insert Template... -> Treemap to insert code block.

image

DualAxes

Use command Insert Template... -> DualAxes to insert code block.

image

Mix

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.

image

Bar

Use command Insert Template... -> Bar to insert code block.

image

OrganizationTreeGraph

Use command Insert Template... -> OrganizationTreeGraph to insert code block.

image

Radar

Use command Insert Template... -> Radar to insert code block.

image

TinyLine

Use command Insert Template... -> TinyLine to insert code block.

image

Dataviewjs Example (Column)

Chart data by dataviewjs. Use command Insert Template... -> Dataviewjs Example (Column) to insert code block.

image

Data from CSV file

Import data from external CSV file (Desktop)

Use command Import data from external CSV file to insert data from CSV file.

Load data from internal 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

Multi CSV files

#-----------------#
#- 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

Dataview Plugin Integration

Examples

#-----------------#
#- chart data    -#
#-----------------#
data: |
  dataviewjs:
  return dv.pages()
           .groupBy(p => p.file.folder)
		   .map(p => ({folder: p.key || "ROOT", count: p.rows.length}))
		   .array();

image

#-----------------#
#- 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();

image

#-----------------#
#- chart data    -#
#-----------------#
data: |
  dataviewjs:
  return dv.pages()
           .groupBy(p => p.file.ctime.toFormat("HH"))
		   .map(p => ({cdate: p.key, count: p.rows.length}))
		   .array();

image

#-----------------#
#- 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();

image

Allowed methods

  • 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

Manually installing the plugin

  • Copy over main.js, styles.css, manifest.json to your vault VaultFolder/.obsidian/plugins/obsidian-chartsview-plugin/.

Ant Design Charts Demos

See https://charts.ant.design/demos/global

obsidian-chartsview-plugin's People

Contributors

caronchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.