| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import { Line } from './BaseCharts'
- export default {
- extends: Line,
- props: {
- firstDate: { // 必须提供字段
- required: true,
- default:false
- },
- labels: { // 必须提供字段
- required: false,
- default:false
- },
- },
- watch: {
- // 动态加载
- firstDate(curVal, oldVal) {
- const that = this;
- if (curVal) {
- this.firstDate = curVal;
- that.renderChart({
- datasets: this.firstDate,
- labels: this.labels,
- // labels: '',
- }, {
- responsive: true,
- maintainAspectRatio: false,
- cutoutPercentage: 90,//环粗细
- showTooltips:false,
- title:false,
- tooltips:{
- mode:'index',
- intersect:false
- },
- legend: {
- position:'bottom',
- labels: {
- boxWidth:12,
- fontSize:10
- }
- },
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: true,
- callback: function (value) {
- if (value % 1 === 0) {
- return value;
- }
- }
- }
- }]
- }
- })
- }
- },
- },
- mounted() {
- const that = this;
- that.renderChart({
- labels: this.labels,
- datasets:this.firstDate
- }, {
- responsive: true,
- maintainAspectRatio: false,
- cutoutPercentage: 90,//环粗细
- showTooltips:false,
- title:false,
- tooltips:{
- mode:'index',
- intersect:false
- },
- legend: {
- position:'bottom',
- labels: {
- boxWidth:12,
- fontSize:10
- }
- },
- scales: {
- yAxes: [{
- ticks: {
- beginAtZero: true,
- callback: function (value) {
- if (value % 1 === 0) {
- return value;
- }
- }
- }
- }]
- }
- })
- }
- }
|