viser icon indicating copy to clipboard operation
viser copied to clipboard

Scale只能将横坐标为时间的时候设置为非连续型吗?

Open Zuojiangtao opened this issue 5 years ago • 0 comments

image

在横坐标数据非时间类型时,能否设置为非连续型呢??

<v-chart
            key="chart1"
            :forceFit="true"
            height="400"
            :scale="scale"
            :padding="['auto', 50, 'auto', 50]"
            :data="typeData"
          >
            <v-tooltip :htmlContent="chartTooltipHtmlContent"/>
            <!-- <v-tooltip :htmlContent="chartTooltipHtmlContent" :g2TooltipMarker="{backgroundColor:'red',color:'red'}" :g2Tooltip="{backgroundColor:'rgba(0,0,0,0.75)'}" :g2TooltipTitle="{color:'#ffffff',fontSize:'14px'}" :g2TooltipListItem="{color:'#ffffff',fontSize:'14px'}"/> -->
            <!--<v-stack-bar :size="20" position="name*value" :color="['bar', ['#0C6FE1', '#2D99FE']]"/>-->
            <v-bar position="type*count" :color="'rgba(255,192,42,1)'" />
            <v-axis/>
          </v-chart>
scale: [{
        dataKey: 'type', // 横坐标时间类型: time:连续型;timeCat:非连续型
        type: 'timeCat'
      }, {
        dataKey: 'count',
        formatter: (text) => {
          if (text % 1 !== 0) {
            return ''
          }
          return text
        }
      }]

其中,横坐标数据映射字段为:type;纵坐标为:count;

Zuojiangtao avatar Sep 02 '20 09:09 Zuojiangtao