Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-boss
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
wx-boss
Commits
dc723ba3
Commit
dc723ba3
authored
Dec 03, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改消费视图
parent
6a3e6895
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
100 deletions
+73
-100
PayTypeChart.js
miniprogram/pages/components/PayTypeChart/PayTypeChart.js
+18
-46
PayTypeChart.ts
miniprogram/pages/components/PayTypeChart/PayTypeChart.ts
+55
-54
No files found.
miniprogram/pages/components/PayTypeChart/PayTypeChart.js
View file @
dc723ba3
...
@@ -15,6 +15,7 @@ function initChart(canvas, width, height, F2) {
...
@@ -15,6 +15,7 @@ function initChart(canvas, width, height, F2) {
el
:
canvas
,
el
:
canvas
,
width
:
width
,
width
:
width
,
height
:
height
,
height
:
height
,
padding
:
[
'auto'
,
'auto'
,
50
,
'auto'
],
});
});
paytypeChart
.
source
(
data
,
{
paytypeChart
.
source
(
data
,
{
days
:
{
days
:
{
...
@@ -30,43 +31,32 @@ function initChart(canvas, width, height, F2) {
...
@@ -30,43 +31,32 @@ function initChart(canvas, width, height, F2) {
padding
:
[
6
,
10
],
padding
:
[
6
,
10
],
},
},
onShow
:
function
(
ev
)
{
onShow
:
function
(
ev
)
{
console
.
log
(
ev
);
var
items
=
ev
.
items
;
var
items
=
ev
.
items
;
items
[
0
].
name
=
''
;
items
[
0
].
name
=
items
[
0
].
title
;
items
[
0
].
value
=
month
+
'-'
+
items
[
0
].
title
;
items
[
0
].
value
=
util_1
.
formatPrice
(
Number
(
items
[
0
].
value
));
items
[
1
].
name
=
''
;
items
[
1
].
value
=
items
[
1
].
value
+
'元'
;
},
},
});
});
paytypeChart
.
coord
(
'polar'
,
{
transposed
:
true
,
innerRadius
:
0.5
,
radius
:
0.9
,
});
paytypeChart
.
legend
({
paytypeChart
.
legend
({
position
:
'right'
,
position
:
'right'
,
marker
:
'square'
,
marker
:
'square'
,
onClick
:
function
(
ev
)
{
var
tooltip
=
paytypeChart
.
get
(
'tooltip'
);
console
.
log
(
ev
,
tooltip
);
},
});
});
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
:
{
paytypeChart
.
render
();
rotate
:
-
Math
.
PI
/
4
,
var
frontPlot
=
paytypeChart
.
get
(
'frontPlot'
);
textAlign
:
'end'
,
var
coord
=
paytypeChart
.
get
(
'coord'
);
textBaseline
:
'middle'
,
frontPlot
.
addShape
(
'sector'
,
{
attrs
:
{
x
:
coord
.
circleRadius
*
(
1
+
coord
.
innerRadius
)
+
coord
.
endAngle
,
y
:
coord
.
center
.
y
,
r
:
0
,
r0
:
coord
.
circleRadius
*
coord
.
innerRadius
*
1.1
,
fill
:
'#fff'
,
},
},
});
});
paytypeChart
.
get
(
'canvas'
).
draw
();
paytypeChart
.
render
();
console
.
log
(
'coord'
,
coord
);
return
paytypeChart
;
return
paytypeChart
;
}
}
Component
({
Component
({
...
@@ -75,24 +65,6 @@ Component({
...
@@ -75,24 +65,6 @@ Component({
type
:
Array
,
type
:
Array
,
value
:
[],
value
:
[],
observer
:
function
(
newVal
)
{
observer
:
function
(
newVal
)
{
paytypeChart
&&
paytypeChart
.
legend
({
position
:
'right'
,
marker
:
'square'
,
itemFormatter
:
function
(
val
)
{
var
item
=
newVal
.
find
(
function
(
item
)
{
return
item
.
key
===
val
;
});
if
(
item
)
{
var
name_1
=
item
.
name
;
if
(
item
&&
item
.
name
.
length
<
4
)
{
name_1
+=
'
\
xa0
\
xa0
\
xa0'
;
}
return
name_1
+
' '
+
util_1
.
formatPrice
(
item
.
count
);
}
else
{
return
''
;
}
},
});
paytypeChart
&&
paytypeChart
.
changeData
(
newVal
);
paytypeChart
&&
paytypeChart
.
changeData
(
newVal
);
},
},
},
},
...
@@ -110,4 +82,4 @@ Component({
...
@@ -110,4 +82,4 @@ Component({
},
},
},
},
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUGF5VHlwZUNoYXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiUGF5VHlwZUNoYXJ0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNENBQWtEO0FBR2xELElBQUksWUFBWSxHQUFHLElBQUksQ0FBQztBQUN4QixJQUFJLEtBQUssR0FBRyxFQUFFLENBQUM7QUFDZixJQUFNLFFBQVEsR0FBRztJQUNmLElBQUksRUFBRSxTQUFTO0lBQ2YsSUFBSSxFQUFFLFNBQVM7SUFDZixRQUFRLEVBQUUsU0FBUztJQUNuQixNQUFNLEVBQUUsU0FBUztDQUNsQixDQUFDO0FBRUYsbUJBQW1CLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLEVBQUU7SUFDMUMsSUFBTSxJQUFJLEdBQUcsRUFBRSxDQUFDO0lBQ2hCLFlBQVksR0FBRyxJQUFJLEVBQUUsQ0FBQyxLQUFLLENBQUM7UUFDMUIsRUFBRSxFQUFFLE1BQU07UUFDVixLQUFLLE9BQUE7UUFDTCxNQUFNLFFBQUE7S0FDUCx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ge1xuICAgICAgICAgICAgICAgIGxldCBuYW1lID0gaXRlbS5uYW1lO1xuICAgICAgICAgICAgICAgIGlmIChpdGVtICYmIGl0ZW0ubmFtZS5sZW5ndGggPCA0KSB7XG4gICAgICAgICAgICAgICAgICBuYW1lICs9ICdcXHhhMFxceGEwXFx4YTAnO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gbmFtZSArICcgICAnICsgZm9ybWF0UHJpY2UoaXRlbS5jb3VudCk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuICcnO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gY3VzdG9tOiB0cnVlLFxuICAgICAgICAgICAgLy8gaXRlbXM6IG5ld1ZhbC5tYXAoaXRlbSA9PiAoe1xuICAgICAgICAgICAgLy8gICBuYW1lOiBpdGVtLm5hbWUsXG4gICAgICAgICAgICAvLyAgIHZhbHVlOiAnICcgKyBmb3JtYXRQcmljZShpdGVtLmNvdW50KSxcbiAgICAgICAgICAgIC8vICAgbWFya2VyOiB7XG4gICAgICAgICAgICAvLyAgICAgc3ltYm9sOiAnc3F1YXJlJyxcbiAgICAgICAgICAgIC8vICAgICBmaWxsOiBjb2xvck1hcFtpdGVtLmtleV0sXG4gICAgICAgICAgICAvLyAgICAgcmFkaXVzOiA0LFxuICAgICAgICAgICAgLy8gICB9LFxuICAgICAgICAgICAgLy8gfSkpLFxuICAgICAgICAgIH0pO1xuICAgICAgICBwYXl0eXBlQ2hhcnQgJiYgcGF5dHlwZUNoYXJ0LmNoYW5nZURhdGEobmV3VmFsKTtcbiAgICAgIH0sXG4gICAgfSxcbiAgICBtb250aDoge1xuICAgICAgdHlwZTogU3RyaW5nLFxuICAgICAgdmFsdWU6ICcnLFxuICAgICAgb2JzZXJ2ZXIobmV3VmFsKSB7XG4gICAgICAgIG1vbnRoID0gbmV3VmFsO1xuICAgICAgfSxcbiA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AgICAgICB9XG4gICAgICAgIC8vICAgICAgICAgcmV0dXJuIG5hbWUgKyAnICAgJyArIGZvcm1hdFByaWNlKGl0ZW0uY291bnQpO1xuICAgICAgICAvLyAgICAgICB9IGVsc2Uge1xuICAgICAgICAvLyAgICAgICAgIHJldHVybiAnJztcbiAgICAgICAgLy8gICAgICAgfVxuICAgICAgICAvLyAgICAgfSxcbiAgICAgICAgLy8gICB9KTtcbiAgICAgICAgcGF5dHlwZUNoYXJ0ICYmIHBheXR5cGVDaGFydC5jaGFuZ2VEYXRhKG5ld1ZhbCk7XG4gICAgICB9LFxuICAgIH0sXG4gICAgbW9udGg6IHtcbiAgICAgIHR5cGU6IFN0cmluZyxcbiAgICAgIHZhbHVlOiAnJyxcbiAgICAgIG9ic2VydmVyKG5ld1ZhbCkge1xuICAgICAgICBtb250aCA9IG5ld1ZhbDtcbiAgICAgIH0sXG4gICAgfSxcbiAgfSxcbiAgZGF0YToge1xuICAgIG9wdHM6IHtcbiAgICAgIG9uSW5pdDogaW5pdENoYXJ0LFxuICAgIH0sXG4gIH0sXG59KTtcbiJdfQ==
\ No newline at end of file
\ No newline at end of file
miniprogram/pages/components/PayTypeChart/PayTypeChart.ts
View file @
dc723ba3
...
@@ -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
);
},
},
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment