2 lines
1.0 KiB
JavaScript
2 lines
1.0 KiB
JavaScript
import{C as i}from"./index-CN67pQjh.js";import{d as s,r as d,l as c,e as h,n as l,c as p,o as u}from"./index-D2_T1wn8.js";import"./conjugateGradient-Bo7LGy1w.js";import"./index-DtwzQIQG.js";const m=["id"],w=s({__name:"PieChart",props:{id:{default:new Date().getTime()+"_"+Math.floor(Math.random()*1e3)},data:{},height:{default:500}},setup(o){const a=o,t=d({id:c(()=>a.id),chartObject:null,data:c(()=>a.data)}),n=()=>{t.chartObject=new i({container:t.id,autoFit:!0,height:a.height}),t.chartObject.coordinate("theta",{radius:.75}),t.chartObject.scale("percent",{formatter:e=>(e=(e*100).toFixed(2)+"%",e)}),t.chartObject.tooltip({showTitle:!1,showMarkers:!1}),t.chartObject.interval().position("percent").color("type").label("percent",{content:e=>`${e.type}: ${(e.percent*100).toFixed(2)}%`}).adjust("stack"),t.chartObject.interaction("element-active")},r=e=>{t.chartObject&&(t.chartObject.annotation().clear(!0),t.chartObject.data(e),t.chartObject.render())};return h(()=>{n(),r(t.data)}),l(t.data,e=>{r(e)}),(e,b)=>(u(),p("div",{id:t.id},null,8,m))}});export{w as default};
|