@@ -20,7 +20,7 @@ import { VirusChart } from './virusChart';
2020import mapUrls from '../../data/map/district' ;
2121
2222type MapDataType = {
23- [ name : string ] : any
23+ [ name : string ] : any ;
2424} ;
2525
2626type STMapDataType = {
@@ -41,7 +41,7 @@ interface Props {
4141
4242const mapName = ( name : string ) => {
4343 return name === '中国' ? 'china' : 'map' ;
44- }
44+ } ;
4545
4646const PALETTE = [
4747 '#FFFFFF' ,
@@ -68,8 +68,7 @@ function createPieces(breaks: number[], palette: string[]) {
6868 ] ;
6969}
7070
71- export class VirusMap extends React . Component < Props > {
72-
71+ export class VirusMap extends React . Component < Props > {
7372 constructor ( props : Props ) {
7473 super ( props ) ;
7574 this . state = {
@@ -89,7 +88,7 @@ export class VirusMap extends React.Component<Props> {
8988 chartOnClickCallBack : ( param : any , chart : any ) => {
9089 console . log ( param , chart ) ;
9190 }
92- }
91+ } ;
9392
9493 public state = {
9594 mapScale : 1 ,
@@ -190,7 +189,9 @@ export class VirusMap extends React.Component<Props> {
190189 outputArray . push ( '死亡:' + data [ params . name ] . dead ) ;
191190 }
192191 if ( this . props . type === 'mobile' ) {
193- outputArray . push ( '<br/><div id="tooltip-detail">再次点击查看详情</div>' ) ;
192+ outputArray . push (
193+ '<br/><div id="tooltip-detail">再次点击查看详情</div>'
194+ ) ;
194195 }
195196 return outputArray . join ( '<br/>' ) ;
196197 }
@@ -227,6 +228,8 @@ export class VirusMap extends React.Component<Props> {
227228 // autoPlay: true,
228229 playInterval : 1500 ,
229230 currentIndex : data . timeline . length - 1 ,
231+ left : '20px' ,
232+ right : '20px' ,
230233 data : data . timeline ,
231234 label : {
232235 fontSize : 10 ,
@@ -236,7 +239,7 @@ export class VirusMap extends React.Component<Props> {
236239 align : 'right' ,
237240 baseline : 'middle'
238241 } ,
239- formatter : function ( param : any ) {
242+ formatter : function ( param : any ) {
240243 return new Date ( parseInt ( param , 10 ) )
241244 . toLocaleDateString ( 'zh-CN' )
242245 . substring ( 5 ) ; // year is not necessary, standardize to ISO
@@ -254,22 +257,44 @@ export class VirusMap extends React.Component<Props> {
254257 }
255258
256259 public render ( ) {
257- const { name, data, chartOnClickCallBack, chartData, chartPath, currentChartArea, type } = this . props ;
258- const mapUrl = mapUrls [ name ]
260+ const {
261+ name,
262+ data,
263+ chartOnClickCallBack,
264+ chartData,
265+ chartPath,
266+ currentChartArea,
267+ type
268+ } = this . props ;
269+ const mapUrl = mapUrls [ name ] ;
259270
260271 return (
261- < div style = {
262- type === 'mobile' ?
263- { display : 'flex' , flexDirection : 'column' , width : '100%' , height : '100%' } :
264- { display : 'flex' , flexDirection : 'row' , width : '100%' , height : '100%' }
265- } >
266- < div style = {
267- type !== 'mobile' ?
268- type !== 'overview' ?
269- { width : '65%' , height : '100%' } :
270- { width : '100%' , height : '100%' } :
271- { width : '100%' , height : '50%' }
272- } >
272+ < div
273+ style = {
274+ type === 'mobile'
275+ ? {
276+ display : 'flex' ,
277+ flexDirection : 'column' ,
278+ width : '100%' ,
279+ height : '100%'
280+ }
281+ : {
282+ display : 'flex' ,
283+ flexDirection : 'row' ,
284+ width : '100%' ,
285+ height : '100%'
286+ }
287+ }
288+ >
289+ < div
290+ style = {
291+ type !== 'mobile'
292+ ? type !== 'overview'
293+ ? { width : '65%' , height : '100%' }
294+ : { width : '100%' , height : '100%' }
295+ : { width : '100%' , height : '50%' }
296+ }
297+ >
273298 < EchartsMap
274299 mapUrl = { mapUrl }
275300 mapName = { mapName ( name ) }
@@ -282,13 +307,15 @@ export class VirusMap extends React.Component<Props> {
282307 mobile = { type === 'mobile' }
283308 />
284309 </ div >
285- < div style = {
286- type !== 'mobile' ?
287- type !== 'overview' ?
288- { width : '65%' , height : '100%' } :
289- { display : 'none' } :
290- { width : '100%' , height : '50%' }
291- } >
310+ < div
311+ style = {
312+ type !== 'mobile'
313+ ? type !== 'overview'
314+ ? { width : '65%' , height : '100%' }
315+ : { display : 'none' }
316+ : { width : '100%' , height : '50%' }
317+ }
318+ >
292319 < VirusChart
293320 data = { chartData }
294321 area = { currentChartArea }
0 commit comments