国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Ant Design Charts 自定義提示信息、圖例、文本信息

這篇具有很好參考價值的文章主要介紹了Ant Design Charts 自定義提示信息、圖例、文本信息。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

Ant Design Charts

ant-design/charts,javascript,前端,react.js

自定義圖例 legend
關(guān)閉圖例
legend: false;

圖例配置參數(shù),布局類型 layout 圖例展示位置 position

legend: {
  layout: 'horizontal',
  position: 'right'
}

布局類型 layout
optional horizontal | vertical
圖例布局方式。提供橫向布局和縱向布局。

圖例展示位置 position
圖例位置,可選項(xiàng):‘top’, ‘top-left’, ‘top-right’, ‘left’, ‘left-top’, ‘left-bottom’, ‘right’, ‘right-top’, ‘right-bottom’, ‘bottom’, ‘bottom-left’, ‘bottom-right’。

import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Pie } from '@ant-design/plots';
const DemoPie = () => {
  const data = [
    {
      type: '分類一',
      value: 27,
    },
    {
      type: '分類二',
      value: 25,
    },
    {
      type: '分類三',
      value: 18,
    },
  ];
  const config = {
    appendPadding: 10,
    data,
    angleField: 'value',
    colorField: 'type',
    radius: 0.9,
    legend: {
     position: 'bottom'
    },
  };
  return <Pie {...config} />;
};

ReactDOM.render(<DemoPie />, document.getElementById('container'));

自定義文本標(biāo)簽 label
屬性名 類型 介紹
type string 當(dāng)用戶使用了自定義的 label 類型,需要聲明具體的 type 類型,否則會使用默認(rèn)的 label 類型渲染(餅圖 label 支持 `inner
offset number label 的偏移量
offsetX number label 相對于數(shù)據(jù)點(diǎn)在 X 方向的偏移距離
offsetY number label 相對于數(shù)據(jù)點(diǎn)在 Y 方向的偏移距離
content *string IGroup
style ShapeAttrs label 文本圖形屬性樣式
autoRotate string 是否自動旋轉(zhuǎn),默認(rèn) true
rotate number 文本旋轉(zhuǎn)角度
labelLine null boolean
labelEmit boolean 只對極坐標(biāo)下的文本生效,表示文本是否按照角度進(jìn)行放射狀顯示,true 表示開啟,false 表示關(guān)閉
layout *‘overlap’ ‘fixedOverlap’
position *‘top’ ‘bottom’
animate boolean AnimateOption
formatter Function 格式化函數(shù)
autoHide boolean 是否自動隱藏,默認(rèn) false

import
 React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Pie } from '@ant-design/plots';
const DemoPie = () => {
  const data = [
    {
      type: '分類一',
      value: 27,
    },
    {
      type: '分類二',
      value: 25,
    },
    {
      type: '分類三',
      value: 18,
    },
  ];
  const config = {
    appendPadding: 10,
    data,
    angleField: 'value',
    colorField: 'type',
    radius: 0.9,
    label: {
       // 可手動配置 label 數(shù)據(jù)標(biāo)簽位置
       position: 'middle',
       // 'top', 'bottom', 'middle'
       // 可配置附加的布局方法
       layout: [
         // 柱形圖數(shù)據(jù)標(biāo)簽位置自動調(diào)整
         {
           type: 'interval-adjust-position',
         }, // 數(shù)據(jù)標(biāo)簽防遮擋
         {
           type: 'interval-hide-overlap',
         }, // 數(shù)據(jù)標(biāo)簽文顏色自動調(diào)整
         {
           type: 'adjust-color',
         },
       ],
     },
  };
  return <Pie {...config} />;
};

ReactDOM.render(<DemoPie />, document.getElementById('container'));

自定義提示信息 tooltip
指定 tooltip 中顯示的字段,默認(rèn)不同圖表有不同的默認(rèn)字段列表。配合 formatter 配置一起使用,效果更佳。

tooltip: {
  fields: ['想要顯示的字段一般是data中的值或者x,y軸數(shù)據(jù)'],
}

格式化 tooltip item 內(nèi)容

tooltip: {
  formatter: (item) => {
    return { name: item.type, value: item.value + '%' };
  },
}

格式化 輸出樣式 itemTpl文章來源地址http://www.zghlxwxcb.cn/news/detail-673468.html

import
 React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { Pie } from '@ant-design/plots';
const DemoPie = () => {
  const data = [
    {
      type: '分類一',
      value: 27,
      percent:30,
    },
    {
      type: '分類二',
      value: 25,
      percent:30,
    },
    {
      type: '分類三',
      value: 18,
      percent:40,
    },
  ];
  const config = {
    appendPadding: 10,
    data,
    angleField: 'value',
    colorField: 'type',
    radius: 0.9,
 	tooltip: {
        showTitle: false,//關(guān)閉標(biāo)題
        fields: ['type', 'percent', 'value'],
        formatter: (item) => {
          return { type: item.type, percent: item.percent,value:item.value};
        },
        itemTpl: '<div><p class="g2-tooltip-item"><span style="background-color:{color};" class="g2-tooltip-marker"></span>{type}</p><p class="g2-tooltip-item"><span  class="g2-tooltip-marker"></span>{value}</p><p class="g2-tooltip-item"><span  class="g2-tooltip-marker"></span>{percent} %</p></div>'

      }
  };
  return <Pie {...config} />;
};

ReactDOM.render(<DemoPie />, document.getElementById('container'));

到了這里,關(guān)于Ant Design Charts 自定義提示信息、圖例、文本信息的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 26、react UI 組件庫 Ant-design 螞蟻金服UI組件庫

    26、react UI 組件庫 Ant-design 螞蟻金服UI組件庫

    material-ui (國外) 官網(wǎng):https://mui.com/zh/material-ui/getting-started/installation/ 這是國外非常流行的 react UI 組件庫,但是在國內(nèi)并不是很常用。 Ant-design UI組件庫 官網(wǎng):https://ant.design/index-cn 這是國內(nèi)比較流行 react UI 組件庫,又螞蟻金服團(tuán)隊(duì)開發(fā)。這一篇博客主要來講解在 react 項(xiàng)目中

    2024年02月08日
    瀏覽(33)
  • vue2安裝ant-design UI報(bào)錯 ERR! peer vue@“>=3.2.0“ from ant-design-vue@3.2.15

    vue2安裝ant-design UI報(bào)錯 ERR! peer vue@“>=3.2.0“ from ant-design-vue@3.2.15

    npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: default@0.1.0 npm ERR! Found: vue@2.7.14 npm ERR! ? vue@\\\"^2.6.10\\\" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@\\\"=3.2.0\\\" from ant-design-vue@3.2.15 npm ERR! node_modules/ant-design-vue npm ERR! ? ant-design

    2024年02月01日
    瀏覽(26)
  • Ant-Design 官方網(wǎng)站總是打不開,那么我們則需要使用以下該官網(wǎng)的鏡像地址來打開;

    ? 1、 Ant-Design 官網(wǎng)原地址:?https://ant.design/index-cn Ant-Design 官網(wǎng)鏡像地址:http://ant-design.gitee.io/index-cn 或者??Ant Design - 一套企業(yè)級 UI 設(shè)計(jì)語言和 React 組件庫 ? 2、 Ant-Design-Pro 原地址:?https://pro.ant.design/index-cn Ant-Design-Pro 鏡像地址:http://ant-design-pro.gitee.io/index-cn ? 3、

    2024年02月12日
    瀏覽(19)
  • React——Ant Design組件庫Message全局提示的使用

    官網(wǎng)推薦使用Hook調(diào)用的方法 ? ? ? ? 這種方法只能在本頁顯示,如果顯示后跳轉(zhuǎn)頁面就不會顯示。因?yàn)閧contextHolder}是寫在本頁面的。如果需要跳轉(zhuǎn)頁面可以用promise調(diào)用 傳遞的參數(shù)依次為,提示信息、顯示時間、關(guān)閉后觸發(fā)的回調(diào)

    2024年02月11日
    瀏覽(21)
  • Ant Design Vue實(shí)現(xiàn)表格雙擊編輯、添加新行、文字提示

    Ant Design Vue實(shí)現(xiàn)表格雙擊編輯、添加新行、文字提示

    早上剛上班,產(chǎn)品就朝我工位走了過來,一看大事不好,肯定又是來提需求的! 產(chǎn)品:做一個表格,要實(shí)現(xiàn)雙擊編輯的功能 我:做不了 產(chǎn)品:老板提的 我:好的,可以做 老板提的不能做也滴做?? 申明:項(xiàng)目基于Vue+Ant Design實(shí)現(xiàn) 想要實(shí)現(xiàn)雙擊編輯單元格,先開發(fā)一個簡單的

    2024年02月11日
    瀏覽(40)
  • 【React】Ant Design自定義主題風(fēng)格及主題切換

    【React】Ant Design自定義主題風(fēng)格及主題切換

    Ant Design 的自定義主題,對于剛?cè)胧值臅r候感覺真是一臉蒙圈,那今天給它梳理倒騰下; 整體樣式變化,主要兩個部分: https://ant.design/docs/react/customize-theme-cn#theme 官方介紹一大堆,咱們粗暴點(diǎn)就當(dāng)作 key=value 配置內(nèi)容來看和理解! 大體分為四塊配置項(xiàng): 分類 涉及配置項(xiàng) 通

    2024年04月22日
    瀏覽(24)
  • 后端傳遞的圖標(biāo)是字符串形式的 Ant Design 圖標(biāo)組件怎么避免被解析為普通文本

    后端傳遞的圖標(biāo)是字符串形式的 Ant Design 圖標(biāo)組件怎么避免被解析為普通文本

    問題描述 后端傳遞導(dǎo)航,數(shù)據(jù)格式帶了icon。如下 不做處理渲染的話結(jié)果如下 ? 解決方案 導(dǎo)入需要的antd組件,在拿到后端數(shù)據(jù)后把原本的icon字符串替換為antd對應(yīng)的icon組件

    2024年01月20日
    瀏覽(19)
  • Vue 3 中 Ant Design Vue 如何自定義表格 Table 的表頭(列頭)內(nèi)容?

    Vue 3 中 Ant Design Vue 如何自定義表格 Table 的表頭(列頭)內(nèi)容?

    項(xiàng)目用到的是 Ant Design Vue (2.2.8) 組件庫,開發(fā)中遇到一個如下圖的表格,有些表頭文本后面會有一些自定義圖標(biāo),鼠標(biāo)移入圖標(biāo)時顯示對應(yīng)的審批時間提示。當(dāng)前列如果沒有審批時間就會隱藏圖標(biāo),只展示列頭文本。 使用 Ant Design Vue 基礎(chǔ)的 Table 組件是無法滿足這個場景的

    2024年02月16日
    瀏覽(24)
  • ant.design(簡稱antd)中Form表單組件提交表單、表單數(shù)據(jù)效驗(yàn)、表單自定義效驗(yàn)、表單布局集合

    ant.design(簡稱antd)中Form表單組件提交表單、表單數(shù)據(jù)效驗(yàn)、表單自定義效驗(yàn)、表單布局集合

    ? ? ? ??ant.design(簡稱antd)現(xiàn)在我們使用較為廣泛,web端中后臺表單使用非常廣泛,此遍文章集合了表單日常用法及使用注意事項(xiàng)。 ? ? ? ? 下圖是UI目標(biāo)樣式圖? ? ? ? ? ? ? ? ? ? ? ? ? ?1、以下是一個組件,首先引入ant相關(guān)依賴,在引入react相關(guān)依賴,主要使用了For

    2024年02月13日
    瀏覽(25)
  • vue2+ant-design-vue a-select組件二次封裝(支持單選/多選添加全選/分頁(多選跨頁選中)/自定義label)

    vue2+ant-design-vue a-select組件二次封裝(支持單選/多選添加全選/分頁(多選跨頁選中)/自定義label)

    參數(shù) 說明 類型 默認(rèn)值 v-model 綁定值 boolean / string / number/Array - mode 設(shè)置’multiple’\\\'tags’多選 (顯示全選) String - optionSource 下拉數(shù)據(jù)源 Array - width select寬度(可以設(shè)置百分比或px) String 100% customLabel 是否自定義設(shè)置下拉label String - valueKey 傳入的 option 數(shù)組中,要作為最終選擇

    2024年02月08日
    瀏覽(31)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包