Commit dc723ba3 by 姜雷

修改消费视图

parent 6a3e6895
...@@ -16,6 +16,7 @@ function initChart(canvas, width, height, F2) { ...@@ -16,6 +16,7 @@ function initChart(canvas, width, height, F2) {
el: canvas, el: canvas,
width, width,
height, height,
padding: ['auto', 'auto', 50, 'auto'],
}); });
paytypeChart.source(data, { paytypeChart.source(data, {
...@@ -32,46 +33,56 @@ function initChart(canvas, width, height, F2) { ...@@ -32,46 +33,56 @@ function initChart(canvas, width, height, F2) {
padding: [6, 10], padding: [6, 10],
}, },
onShow(ev) { onShow(ev) {
console.log(ev);
const { items } = ev; const { items } = ev;
items[0].name = ''; items[0].name = items[0].title;
items[0].value = month + '-' + items[0].title; items[0].value = formatPrice(Number(items[0].value));
items[1].name = ''; // items[1].name = '';
items[1].value = items[1].value + '元'; // items[1].value = items[1].value + '元';
}, },
}); });
paytypeChart.coord('polar', { // paytypeChart.coord('polar', {
transposed: true, // transposed: true,
innerRadius: 0.5, // innerRadius: 0.5,
radius: 0.9, // radius: 0.9,
}); // });
paytypeChart.legend({ paytypeChart.legend({
position: 'right', position: 'right',
marker: 'square', marker: 'square',
onClick: ev => {
const tooltip = paytypeChart.get('tooltip');
console.log(ev, tooltip);
// paytypeChart.
},
}); });
paytypeChart.tooltip(false);
paytypeChart paytypeChart
.interval() .interval()
.position('a*count') .position('name*count')
.color('key', ['#EB7E59', '#13C2C2', '#FACC14', '#1890FF']) .color('name', ['#EB7E59', '#13C2C2', '#FACC14', '#1890FF']);
.adjust('stack'); paytypeChart.axis('name', {
paytypeChart.axis(false); label: {
rotate: -Math.PI / 4,
textAlign: 'end',
textBaseline: 'middle',
},
});
paytypeChart.render(); paytypeChart.render();
// 绘制内阴影 // 绘制内阴影
const frontPlot = paytypeChart.get('frontPlot'); // const frontPlot = paytypeChart.get('frontPlot');
const coord = paytypeChart.get('coord'); // 获取坐标系对象 // const coord = paytypeChart.get('coord'); // 获取坐标系对象
frontPlot.addShape('sector', { // frontPlot.addShape('sector', {
attrs: { // attrs: {
x: coord.circleRadius * (1 + coord.innerRadius) + coord.endAngle, // x: coord.circleRadius,
y: coord.center.y, // y: coord.center.y,
r: 0, // 全半径 // r: coord.circleRadius * coord.innerRadius * 1.1, // 全半径
r0: coord.circleRadius * coord.innerRadius * 1.1, // r0: 0,
fill: '#fff', // fill: '#000',
}, // },
}); // });
paytypeChart.get('canvas').draw(); // paytypeChart.get('canvas').draw();
console.log('coord', coord); // console.log('coord', coord);
return paytypeChart; return paytypeChart;
} }
...@@ -82,33 +93,23 @@ Component({ ...@@ -82,33 +93,23 @@ Component({
type: Array, type: Array,
value: [], value: [],
observer(newVal) { observer(newVal) {
paytypeChart && // paytypeChart &&
paytypeChart.legend({ // paytypeChart.legend({
position: 'right', // position: 'right',
marker: 'square', // marker: 'square',
itemFormatter: val => { // itemFormatter: val => {
let item = newVal.find(item => item.key === val); // let item = newVal.find(item => item.key === val);
if (item) { // if (item) {
let name = item.name; // let name = item.name;
if (item && item.name.length < 4) { // if (item && item.name.length < 4) {
name += '\xa0\xa0\xa0'; // name += '\xa0\xa0\xa0';
} // }
return name + ' ' + formatPrice(item.count); // return name + ' ' + formatPrice(item.count);
} else { // } else {
return ''; // return '';
} // }
},
// custom: true,
// items: newVal.map(item => ({
// name: item.name,
// value: ' ' + formatPrice(item.count),
// marker: {
// symbol: 'square',
// fill: colorMap[item.key],
// radius: 4,
// }, // },
// })), // });
});
paytypeChart && paytypeChart.changeData(newVal); paytypeChart && paytypeChart.changeData(newVal);
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment