caronchen / obsidian-chartsview-plugin

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

DualAxes 类型直方图无法显示 #65

Open bfcs opened 3 weeks ago

bfcs commented 3 weeks ago

问题描述

结果如下,能获取到数据,但是直方图没有显示,同时控制台有一个警告。 我查看了控制台输出的数据,Exercise和Weight数据都是存在的,同时鼠标悬停在图片上也能看出数据是存在的。重启软件后还是无法显示

image

我的代码

#-----------------#
#- chart type    -#
#-----------------#
type: DualAxes

#-----------------#
#- chart data    -#
#-----------------#
data: |
  dataviewjs:
  d = dv.pages("#daily")
    .groupBy(p => p.file.name)
    .map(p => ({day: p.key, Exercise: p.rows.Exercise, Weight: p.rows.Weight}))
  return [d, d]

#-----------------#
#- chart options -#
#-----------------#
options:
  xField: 'day'
  yField: ['Exercise', 'Weight']
  legend: 
    itemName: 
      formatter: | 
        function (text, item) { return item.value === 'Exercise' ? 'Time of Exercise' : 'Weight in Kg'; }
  xAxis: 
    label:
      autoRotate: false
  yAxis:
    Exercise:
      min: 0
      max: 60
      label:
        formatter:
          function formatter(val) {
            return ''.concat(val, ' mins');
          }
    Weight:
      min: 50
      max: 70
      label:
        formatter:
          function formatter(val) {
            return ''.concat(val, ' kg');
          }
  geometryOptions:
    - geometry: 'column'
      label: 
        position: 'middle'
    - geometry: 'line'
      smooth: true
      lineStyle:
        lineWidth: 3

笔记内容

image

我的环境

MacOS 13 Obsidian 1.7.4

bfcs commented 3 weeks ago

把column换成line就是显示折线图,换成column就是不行

image