caronchen / obsidian-chartsview-plugin

Data visualization solution in Obsidian, support plots and graphs.
MIT License
221 stars 11 forks source link

Open file instead of open search #44

Closed Crownburger closed 1 year ago

Crownburger commented 1 year ago

Is it possible to click on an item in the word cloud and directly open the coresponding file instead of opening the search?

Here is my code:

#-----------------#
#- chart type    -#
#-----------------#
type: WordCloud

#-----------------#
#- chart data    -#
#-----------------#
data: |
  dataviewjs:
  return dv.pages('"MOC" or "Notizen"')
           .sort(s => s.file.inlinks.length+s.file.outlinks.length, 'desc') 
           .map(p => ({notiz: p.file.name, count: p.file.inlinks.length+p.file.outlinks.length}))
           .array();

#-----------------#
#- chart options -#
#-----------------#
options:
  height: 150
  wordField: "notiz"
  weightField: "count"
  colorField: ""
  wordStyle:
    rotation: 0
    fontSize: [8,30]
  enableSearchInteraction: 
    field: 'word'
    operator: 'file'

Would be a huge plus for me if this would be possible!!

Crownburger commented 1 year ago

@caronchen : Is there any chance to get a reply here? Thanks in advance!

caronchen commented 1 year ago

@caronchen : Is there any chance to get a reply here? Thanks in advance!

Upgrade to v1.2.2.

#-----------------#
#- chart type    -#
#-----------------#
type: WordCloud

#-----------------#
#- chart data    -#
#-----------------#
data: |
  dataviewjs:
  return dv.pages()
           .sort(s => s.file.inlinks.length + s.file.outlinks.length, 'desc') 
           .map(p => ({notiz: p.file.name, path: p.file.path, count: p.file.inlinks.length + p.file.outlinks.length}))
           .array();

#-----------------#
#- chart options -#
#-----------------#
options:
  height: 150
  wordField: "notiz"
  weightField: "count"
  colorField: ""
  wordStyle:
    rotation: 0
    fontSize: [8,30]
  enableSearchInteraction: 
    pathField: 'path'
    operator: 'fileopen'
Crownburger commented 1 year ago

That's amazing! Thank you so much!!