Skip to content

Commit

Permalink
fix: solve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Flcwl committed Mar 21, 2022
1 parent 184e37d commit 8e6e00b
Show file tree
Hide file tree
Showing 6 changed files with 447 additions and 388 deletions.
130 changes: 65 additions & 65 deletions src/views/dashboard-data-analysis/content-distribution.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
import React, {useCallback, useEffect, useRef, useState} from 'react'
// @ts-nocheck

import React, { useCallback, useEffect, useRef, useState } from 'react'
import * as Echarts from 'echarts'
import { Loading } from '@hi-ui/loading'
import {fetchContentDistribution} from "./api";
import {EChartsOptionsGenerator} from "./common";
import { fetchContentDistribution } from './api'
import { EChartsOptionsGenerator } from './common'

const generateChartOption =(data: any[]) => (
{
grid: {
left: '48px',
right: '24px',
top: '20px',
bottom: '48px'
},
tooltip:{
show: true
},
color: ['#237FFA'],
xAxis: [
{
type: 'category',
data: data.map(item => item.title),
axisTick: {
show: false
},
offset: 12,
axisLine: {
lineStyle: {
color: '#EBEDF0'
}
const generateChartOption = (data: any[]) => ({
grid: {
left: '48px',
right: '24px',
top: '20px',
bottom: '48px',
},
tooltip: {
show: true,
},
color: ['#237FFA'],
xAxis: [
{
type: 'category',
data: data.map((item) => item.title),
axisTick: {
show: false,
},
offset: 12,
axisLine: {
lineStyle: {
color: '#EBEDF0',
},
axisLabel: {
color: '#1F2733'
}
}
],
yAxis: [
{
type: 'value',
axisLine: {
lineStyle: {
color: '#1F2733'
}
},
axisLabel: {
color: '#1F2733',
},
},
],
yAxis: [
{
type: 'value',
axisLine: {
lineStyle: {
color: '#1F2733',
},
offset: 12,
splitLine: {
lineStyle: {
color: '#EBEDF0'
}
}
}
],
series: [
{
type: 'bar',
// symbol: 'none',
emphasis: {
focus: 'series'
},
offset: 12,
splitLine: {
lineStyle: {
color: '#EBEDF0',
},
data: data.map(item => item.num),
barWidth: 36,
itemStyle:{
borderRadius: 4
}
}
]
}
)
},
},
],
series: [
{
type: 'bar',
// symbol: 'none',
emphasis: {
focus: 'series',
},
data: data.map((item) => item.num),
barWidth: 36,
itemStyle: {
borderRadius: 4,
},
},
],
})
export const ContentDistribution = (props: { style?: React.CSSProperties }) => {
const [container, setContainer] = useState<HTMLDivElement | null>(null)
const chartRef = useRef<Echarts.EChartsType | undefined>()
Expand All @@ -75,7 +75,7 @@ export const ContentDistribution = (props: { style?: React.CSSProperties }) => {

useEffect(() => {
setIsFetching(true)
fetchContentDistribution().then(result => {
fetchContentDistribution().then((result) => {
setData(result.data)
setIsFetching(false)
})
Expand Down Expand Up @@ -107,8 +107,8 @@ export const ContentDistribution = (props: { style?: React.CSSProperties }) => {
return (
<React.Fragment>
<Loading visible={isFetching}>
<div style={{...props.style, position: 'relative'}}>
<div ref={e => setContainer(e)} style={{width: '100%', height: '100%'}}/>
<div style={{ ...props.style, position: 'relative' }}>
<div ref={(e) => setContainer(e)} style={{ width: '100%', height: '100%' }} />
</div>
</Loading>
</React.Fragment>
Expand Down
99 changes: 54 additions & 45 deletions src/views/dashboard-data-analysis/country-view-hot-map.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
import React, {useCallback, useEffect, useRef, useState} from 'react'
// @ts-nocheck

import React, { useCallback, useEffect, useRef, useState } from 'react'
import * as Echarts from 'echarts'
import {Loading} from '@hi-ui/loading'
import {fetchCountryViewHotMap} from "./api";
import {message} from "@hi-ui/hiui";
import { Loading } from '@hi-ui/loading'
import { fetchCountryViewHotMap } from './api'
import { message } from '@hi-ui/hiui'

const generateChartOption = (data: any[]) => (
{
visualMap: {
min: 0,
max: 1600,
realtime: false,
calculable: true,
orient: 'horizontal',
inRange: {
color: ['#fff', '#237FFA']
},
itemWidth: 6,
itemHeight: 160,
textStyle:{
lineHeight: 40
}
const generateChartOption = (data: any[]) => ({
visualMap: {
min: 0,
max: 1600,
realtime: false,
calculable: true,
orient: 'horizontal',
inRange: {
color: ['#fff', '#237FFA'],
},
itemWidth: 6,
itemHeight: 160,
textStyle: {
lineHeight: 40,
},
series:[{
type:'map',
map:'china',
data: data.map(item => ({
},
series: [
{
type: 'map',
map: 'china',
data: data.map((item) => ({
name: item.title,
value: item.num
value: item.num,
})),
top: 10,
bottom: -40,
itemStyle:{
itemStyle: {
borderColor: '#fff',
borderWidth: 1
}
}]
}
)
borderWidth: 1,
},
},
],
})

export const CountryViewHotMap = (props: { style?: React.CSSProperties }) => {
const [container, setContainer] = useState<HTMLDivElement | null>(null)
Expand All @@ -48,26 +50,33 @@ export const CountryViewHotMap = (props: { style?: React.CSSProperties }) => {
useEffect(() => {
const init = async () => {
setIsFetching(true)
const geo = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json').then(e => {
if(e.status === 200){
return e.text()
}else{
return undefined
}
}).catch(e => undefined)
const geo = await fetch('https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json')
.then((e) => {
if (e.status === 200) {
return e.text()
} else {
return undefined
}
})
.catch((e) => undefined)

if(geo){
if (geo) {
const geoObject = JSON.parse(geo)
Echarts.registerMap('china', geoObject)

const result = await fetchCountryViewHotMap([...(geoObject.features as any[]).map(item => item.properties.name).filter(item => item),'南海诸岛'])
const result = await fetchCountryViewHotMap([
...(geoObject.features as any[])
.map((item) => item.properties.name)
.filter((item) => item),
'南海诸岛',
])

setData(result.data)
setIsFetching(false)
}else{
} else {
message.open({
type:'error',
title:'获取全国GEO数据失败'
type: 'error',
title: '获取全国GEO数据失败',
})
}
}
Expand Down Expand Up @@ -101,8 +110,8 @@ export const CountryViewHotMap = (props: { style?: React.CSSProperties }) => {
return (
<React.Fragment>
<Loading visible={isFetching}>
<div style={{...props.style, position: 'relative'}}>
<div ref={e => setContainer(e)} style={{width: '100%', height: '100%'}}/>
<div style={{ ...props.style, position: 'relative' }}>
<div ref={(e) => setContainer(e)} style={{ width: '100%', height: '100%' }} />
</div>
</Loading>
</React.Fragment>
Expand Down
Loading

0 comments on commit 8e6e00b

Please sign in to comment.