Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
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
tianzhuanghu
ant-design-pro-vue
Commits
2f939dcb
Unverified
Commit
2f939dcb
authored
Mar 26, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: search pie
parent
ea9404d2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
244 additions
and
19 deletions
+244
-19
MiniSmoothArea.vue
src/components/Charts/MiniSmoothArea.vue
+40
-0
smooth.area.less
src/components/Charts/smooth.area.less
+15
-0
index.js
src/components/index.js
+2
-0
icons.js
src/core/icons.js
+8
-0
Analysis.vue
src/views/dashboard/Analysis.vue
+179
-19
No files found.
src/components/Charts/MiniSmoothArea.vue
0 → 100644
View file @
2f939dcb
<
template
>
<div
:class=
"prefixCls"
>
<div
class=
"chart-wrapper"
:style=
"
{ height: 46 }">
<v-chart
:force-fit=
"true"
:height=
"100"
:data=
"dataSource"
:scale=
"scale"
:padding=
"[36, 0, 18, 0]"
>
<v-tooltip
/>
<v-smooth-line
position=
"x*y"
:size=
"2"
/>
<v-smooth-area
position=
"x*y"
/>
</v-chart>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'MiniSmoothArea'
,
props
:
{
prefixCls
:
{
type
:
String
,
default
:
'ant-pro-smooth-area'
},
scale
:
{
type
:
[
Object
,
Array
],
required
:
true
},
dataSource
:
{
type
:
Array
,
required
:
true
}
},
data
()
{
return
{
height
:
100
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
@import
"smooth.area.less"
;
</
style
>
src/components/Charts/smooth.area.less
0 → 100644
View file @
2f939dcb
@import "../index";
@smoothArea-prefix-cls: ~"@{ant-pro-prefix}-smooth-area";
.@{smoothArea-prefix-cls} {
position: relative;
width: 100%;
.chart-wrapper {
position: absolute;
bottom: -28px;
width: 100%;
}
}
\ No newline at end of file
src/components/index.js
View file @
2f939dcb
...
@@ -3,6 +3,7 @@ import Bar from '@/components/Charts/Bar'
...
@@ -3,6 +3,7 @@ import Bar from '@/components/Charts/Bar'
import
ChartCard
from
'@/components/Charts/ChartCard'
import
ChartCard
from
'@/components/Charts/ChartCard'
import
Liquid
from
'@/components/Charts/Liquid'
import
Liquid
from
'@/components/Charts/Liquid'
import
MiniArea
from
'@/components/Charts/MiniArea'
import
MiniArea
from
'@/components/Charts/MiniArea'
import
MiniSmoothArea
from
'@/components/Charts/MiniSmoothArea'
import
MiniBar
from
'@/components/Charts/MiniBar'
import
MiniBar
from
'@/components/Charts/MiniBar'
import
MiniProgress
from
'@/components/Charts/MiniProgress'
import
MiniProgress
from
'@/components/Charts/MiniProgress'
import
Radar
from
'@/components/Charts/Radar'
import
Radar
from
'@/components/Charts/Radar'
...
@@ -30,6 +31,7 @@ export {
...
@@ -30,6 +31,7 @@ export {
ChartCard
,
ChartCard
,
Liquid
,
Liquid
,
MiniArea
,
MiniArea
,
MiniSmoothArea
,
MiniBar
,
MiniBar
,
MiniProgress
,
MiniProgress
,
Radar
,
Radar
,
...
...
src/core/icons.js
View file @
2f939dcb
/**
* Custom icon list
* All icons are loaded here for easy management
* @see https://vue.ant.design/components/icon/#Custom-Font-Icon
*
* 自定义图标加载表
* 所有图标均从这里加载,方便管理
*/
import
bxAnaalyse
from
'@/assets/icons/bx-analyse.svg?inline'
// path to your '*.svg?inline' file.
import
bxAnaalyse
from
'@/assets/icons/bx-analyse.svg?inline'
// path to your '*.svg?inline' file.
export
{
bxAnaalyse
}
export
{
bxAnaalyse
}
src/views/dashboard/Analysis.vue
View file @
2f939dcb
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
<a-row
:gutter=
"12"
>
<a-row
:gutter=
"12"
>
<a-col
:xl=
"12"
:lg=
"24"
:md=
"24"
:sm=
"24"
:xs=
"24"
>
<a-col
:xl=
"12"
:lg=
"24"
:md=
"24"
:sm=
"24"
:xs=
"24"
>
<a-card
:loading=
"loading"
:bordered=
"false"
title=
"线上热门搜索"
:style=
"{ marginTop: '24px' }"
>
<a-card
:loading=
"loading"
:bordered=
"false"
title=
"线上热门搜索"
:style=
"{ marginTop: '24px'
, height: '500px'
}"
>
<a-dropdown
:trigger=
"['click']"
placement=
"bottomLeft"
slot=
"extra"
>
<a-dropdown
:trigger=
"['click']"
placement=
"bottomLeft"
slot=
"extra"
>
<a
class=
"ant-dropdown-link"
href=
"#"
>
<a
class=
"ant-dropdown-link"
href=
"#"
>
<a-icon
type=
"ellipsis"
/>
<a-icon
type=
"ellipsis"
/>
...
@@ -115,17 +115,60 @@
...
@@ -115,17 +115,60 @@
</a-menu-item>
</a-menu-item>
</a-menu>
</a-menu>
</a-dropdown>
</a-dropdown>
<p>
card content
</p>
<a-row
:gutter=
"68"
>
<p>
card content
</p>
<a-col
:xs=
"24"
:sm=
"12"
:style=
"{ marginBottom: ' 24px'}"
>
<p>
card content
</p>
<number-info
:total=
"12321"
:sub-total=
"17.1"
>
<span
slot=
"subtitle"
>
<span>
搜索用户数
</span>
<a-tooltip
title=
"指标说明"
slot=
"action"
>
<a-icon
type=
"info-circle-o"
:style=
"{ marginLeft: '8px' }"
/>
</a-tooltip>
</span>
</number-info>
<!-- miniChart -->
<div>
<mini-smooth-area
:style=
"{ height: '45px' }"
:dataSource=
"searchUserData"
:scale=
"searchUserScale"
/>
</div>
</a-col>
<a-col
:xs=
"24"
:sm=
"12"
:style=
"{ marginBottom: ' 24px'}"
>
<number-info
:total=
"2.7"
:sub-total=
"26.2"
status=
"down"
>
<span
slot=
"subtitle"
>
<span>
人均搜索次数
</span>
<a-tooltip
title=
"指标说明"
slot=
"action"
>
<a-icon
type=
"info-circle-o"
:style=
"{ marginLeft: '8px' }"
/>
</a-tooltip>
</span>
</number-info>
<!-- miniChart -->
<div>
<mini-smooth-area
:style=
"{ height: '45px' }"
:dataSource=
"searchUserData"
:scale=
"searchUserScale"
/>
</div>
</a-col>
</a-row>
<div
class=
"ant-table-wrapper"
>
<a-table
row-key=
"index"
size=
"small"
:columns=
"searchTableColumns"
:dataSource=
"searchData"
:pagination=
"{ pageSize: 5 }"
/>
</div>
</a-card>
</a-card>
</a-col>
</a-col>
<a-col
:xl=
"12"
:lg=
"24"
:md=
"24"
:sm=
"24"
:xs=
"24"
>
<a-col
:xl=
"12"
:lg=
"24"
:md=
"24"
:sm=
"24"
:xs=
"24"
>
<a-card
:loading=
"loading"
:bordered=
"false"
title=
"销售额类别占比"
:style=
"{ marginTop: '24px' }"
>
<a-card
:loading=
"loading"
:bordered=
"false"
title=
"销售额类别占比"
:style=
"{ marginTop: '24px', height: '500px' }"
>
<a-dropdown
:trigger=
"['click']"
placement=
"bottomLeft"
slot=
"extra"
>
<div
slot=
"extra"
style=
"height: inherit;"
>
<a
class=
"ant-dropdown-link"
href=
"#"
>
<div
style=
"bottom: 12px;display: inline-block;"
>
<a-icon
type=
"ellipsis"
/>
<a-radio-group
defaultValue=
"a"
>
</a>
<a-radio-button
value=
"a"
>
全部渠道
</a-radio-button>
<a-radio-button
value=
"b"
>
线上
</a-radio-button>
<a-radio-button
value=
"c"
>
门店
</a-radio-button>
</a-radio-group>
</div>
<span
class=
"dashboard-analysis-iconGroup"
>
<a-dropdown
:trigger=
"['click']"
placement=
"bottomLeft"
>
<a-icon
type=
"ellipsis"
class=
"ant-dropdown-link"
/>
<a-menu
slot=
"overlay"
>
<a-menu
slot=
"overlay"
>
<a-menu-item>
<a-menu-item>
<a
href=
"javascript:;"
>
操作一
</a>
<a
href=
"javascript:;"
>
操作一
</a>
...
@@ -135,9 +178,18 @@
...
@@ -135,9 +178,18 @@
</a-menu-item>
</a-menu-item>
</a-menu>
</a-menu>
</a-dropdown>
</a-dropdown>
<p>
card content
</p>
</span>
<p>
card content
</p>
</div>
<p>
card content
</p>
<h4>
销售额
</h4>
<div>
<v-chart
:force-fit=
"true"
:height=
"350"
:data=
"pieData"
:scale=
"pieScale"
>
<v-tooltip
:showTitle=
"false"
dataKey=
"item*percent"
/>
<v-axis
/>
<v-legend
dataKey=
"item"
/>
<v-pie
position=
"percent"
color=
"item"
:vStyle=
"pieStyle"
:label=
"labelConfig"
/>
<v-coord
type=
"theta"
:radius=
"0.75"
:innerRadius=
"0.6"
/>
</v-chart>
</div>
</a-card>
</a-card>
</a-col>
</a-col>
</a-row>
</a-row>
...
@@ -145,9 +197,8 @@
...
@@ -145,9 +197,8 @@
</template>
</template>
<
script
>
<
script
>
import
ACol
from
'ant-design-vue/es/grid/Col'
import
moment
from
'moment'
import
ATooltip
from
'ant-design-vue/es/tooltip/Tooltip'
import
{
ChartCard
,
MiniArea
,
MiniBar
,
MiniProgress
,
RankList
,
Bar
,
Trend
,
NumberInfo
,
MiniSmoothArea
}
from
'@/components'
import
{
ChartCard
,
MiniArea
,
MiniBar
,
MiniProgress
,
RankList
,
Bar
,
Trend
}
from
'@/components'
const
rankList
=
[]
const
rankList
=
[]
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
...
@@ -157,23 +208,122 @@ for (let i = 0; i < 7; i++) {
...
@@ -157,23 +208,122 @@ for (let i = 0; i < 7; i++) {
})
})
}
}
const
searchUserData
=
[]
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
searchUserData
.
push
({
x
:
moment
().
add
(
i
,
'days'
).
format
(
'YYYY-MM-DD'
),
y
:
Math
.
ceil
(
Math
.
random
()
*
10
)
})
}
const
searchUserScale
=
[
{
dataKey
:
'x'
,
alias
:
'时间'
},
{
dataKey
:
'y'
,
alias
:
'用户数'
,
min
:
0
,
max
:
10
}]
const
searchTableColumns
=
[
{
dataIndex
:
'index'
,
title
:
'排名'
,
width
:
90
},
{
dataIndex
:
'keyword'
,
title
:
'搜索关键词'
},
{
dataIndex
:
'count'
,
title
:
'用户数'
,
width
:
164
},
{
dataIndex
:
'range'
,
title
:
'周涨幅'
,
align
:
'right'
,
sorter
:
(
a
,
b
)
=>
a
.
range
-
b
.
range
,
width
:
164
}
]
const
searchData
=
[]
for
(
let
i
=
0
;
i
<
50
;
i
+=
1
)
{
searchData
.
push
({
index
:
i
+
1
,
keyword
:
`搜索关键词-
${
i
}
`
,
count
:
Math
.
floor
(
Math
.
random
()
*
1000
),
range
:
Math
.
floor
(
Math
.
random
()
*
100
),
status
:
Math
.
floor
((
Math
.
random
()
*
10
)
%
2
)
})
}
const
DataSet
=
require
(
'@antv/data-set'
)
const
sourceData
=
[
{
item
:
'家用电器'
,
count
:
32.2
},
{
item
:
'食用酒水'
,
count
:
21
},
{
item
:
'个护健康'
,
count
:
17
},
{
item
:
'服饰箱包'
,
count
:
13
},
{
item
:
'母婴产品'
,
count
:
9
},
{
item
:
'其他'
,
count
:
7.8
}
]
const
pieScale
=
[{
dataKey
:
'percent'
,
min
:
0
,
formatter
:
'.0%'
}]
const
dv
=
new
DataSet
.
View
().
source
(
sourceData
)
dv
.
transform
({
type
:
'percent'
,
field
:
'count'
,
dimension
:
'item'
,
as
:
'percent'
})
const
pieData
=
dv
.
rows
export
default
{
export
default
{
name
:
'Analysis'
,
name
:
'Analysis'
,
components
:
{
components
:
{
ATooltip
,
ACol
,
ChartCard
,
ChartCard
,
MiniArea
,
MiniArea
,
MiniBar
,
MiniBar
,
MiniProgress
,
MiniProgress
,
RankList
,
RankList
,
Bar
,
Bar
,
Trend
Trend
,
NumberInfo
,
MiniSmoothArea
},
},
data
()
{
data
()
{
return
{
return
{
loading
:
true
,
loading
:
true
,
rankList
rankList
,
// 搜索用户数
searchUserData
,
searchUserScale
,
searchTableColumns
,
searchData
,
//
pieScale
,
pieData
,
sourceData
,
pieStyle
:
{
stroke
:
'#fff'
,
lineWidth
:
1
},
labelConfig
:
[
'percent'
,
{
formatter
:
(
val
,
item
)
=>
{
return
item
.
point
.
item
+
': '
+
val
}
}]
}
}
},
},
created
()
{
created
()
{
...
@@ -198,4 +348,14 @@ export default {
...
@@ -198,4 +348,14 @@ export default {
}
}
}
}
}
}
.dashboard-analysis-iconGroup
{
i
{
margin-left
:
16px
;
color
:
rgba
(
0
,
0
,
0
,
.45
);
cursor
:
pointer
;
transition
:
color
.32s
;
color
:
black
;
}
}
</
style
>
</
style
>
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