Browse Source

uas手机版
图表tooltip修改

samhoo 5 years ago
parent
commit
ffdcfea936

+ 10 - 1
uas-office-web/uas-mobile/src/components/common/bizgoblin/BarGraph.jsx

@@ -43,7 +43,6 @@ export default class BarGraph extends Component {
         <div
           className="ant-table-title-second">{FORMULA_KEYDISPLAY_ ? FORMULA_KEYDISPLAY_ : ''}{FORMULA_VALUEDISPLAY_} {'单位(' + FORMULA_UNIT_ + ')'}</div>
         <Chart padding={[25, 15, 40, 50]} height={300} autoFit data={data}>
-          {/* <Tooltip /> */}
           <Axis name='xField'
                 label={{
                   rotate: -126,
@@ -71,7 +70,17 @@ export default class BarGraph extends Component {
                   },
                 }
               },
+            ]}
+            tooltip={[
+              'yField*xField',
+              (value, name) => {
+                return {
+                  name: `${name}`,
+                  value,
+                }
+              },
             ]}/>
+          <Tooltip showTitle={false}/>
         </Chart>
       </div>
     )

+ 8 - 1
uas-office-web/uas-mobile/src/components/common/bizgoblin/LineChart.jsx

@@ -4,7 +4,7 @@
  */
 
 import React, { Component } from 'react'
-import { Chart, Line, Point, Tooltip, Axis } from 'bizcharts'
+import { Chart, Line, Point, Tooltip, Axis, Geom } from 'bizcharts'
 import { fetchPostObj } from '../../../utils/common/fetchRequest'
 import { API } from '../../../configs/api.config'
 import { isObjEmpty } from '../../../utils/common/common.util'
@@ -50,6 +50,13 @@ export default class LineChart extends Component {
         >
           <Line position="xField*yField"/>
           <Point position="xField*yField"/>
+          <Geom type="line" tooltip={['yField*xField', (value, name) => {
+            return {
+              name: `${name}`,
+              value,
+            }
+          }]} position="xField*yField"/>
+          <Tooltip showTitle={false}/>
         </Chart>
       </div>
     )

+ 9 - 1
uas-office-web/uas-mobile/src/components/common/bizgoblin/PieChart.jsx

@@ -73,6 +73,15 @@ export default class PieChart extends Component {
                 return `${data.xField}: ${getFloat(data.percent * 100, 4)}%`
               },
             }]}
+            tooltip={[
+              'yField*xField',
+              (value, name) => {
+                return {
+                  name: `${name}`,
+                  value,
+                }
+              },
+            ]}
           />
         </Chart>
       </div>
@@ -92,7 +101,6 @@ export default class PieChart extends Component {
       item.yField = Number(item.yField)
       return item
     })
-
     return data
   }