Browse Source

指标看板解析逻辑调整

zhuth 6 years ago
parent
commit
ce0e715b54

+ 6 - 6
src/components/chartDesigner/charts/indicatorView.jsx

@@ -65,8 +65,8 @@ class IndicatorView extends React.Component {
             <div className='row indicator-extra' key={i}>
                 <div className='cell c-extra'>
                     <div className='over-wrapper'>
-                        <span className='til' title={d.name} style={{ color: nameLabelColor }}>{d.name}</span>
-                        <span className='val' title={d.value} style={{ color: valueLabelColor }}>{d.value === undefined || d.value === null ? '--' : d.value}</span>
+                        <span className='til' title={d.name} style={{ color: nameLabelColor }}>{d.name === null ? '空' : d.name}</span>
+                        <span className='val' title={d.value} style={{ color: valueLabelColor }}>{d.value === null ? '--' : d.value}</span>
                     </div>
                 </div>
             </div>
@@ -89,19 +89,19 @@ class IndicatorView extends React.Component {
                 {
                     data.map((d, i) => (
                         <div className={`indicator-box`} key={i} style={{ backgroundColor: boxBackgroundColor }}>
-                            {d.name && <div className='row indicator-name'>
+                            {d.name !== undefined && <div className='row indicator-name'>
                                 <div className='cell c-name'>
-                                    <div className='over-wrapper' title={d.name} style={{ color: nameLabelColor }}>{d.name}</div>
+                                    <div className='over-wrapper' title={d.name} style={{ color: nameLabelColor }}>{d.name === null ? '空' : d.name}</div>
                                 </div>
                             </div>}
                             <div className='row indicator-key'>
                                 <div className='cell c-key'>
-                                    <div className='over-wrapper' title={d.key} style={{ color: keyLabelColor }}>{d.key}</div>
+                                    <div className='over-wrapper' title={d.key} style={{ color: keyLabelColor }}>{d.key === null ? '空': d.key}</div>
                                 </div>
                             </div>
                             <div className='row indicator-value'>
                                 <div className='cell c-value'>
-                                    <div className='over-wrapper' title={d.value} style={{ color: valueLabelColor }}>{(d.value === undefined || d.value === null) ? '--' : d.value}</div>
+                                    <div className='over-wrapper' title={d.value} style={{ color: valueLabelColor }}>{d.value === null ? '--' : d.value}</div>
                                 </div>
                             </div>
                             {d.others && d.others.length > 0 && this.generateExtra(d.others, extraNameLabelColor, extraValueLabelColor)}

+ 1 - 1
src/models/parseChartOption.js

@@ -552,7 +552,7 @@ function indicatorOption(data, indicatorConfig, themeConfig, styleConfig) {
             threshold
         },
         themeConfig,
-        data: data.map(d => ({
+        data: (data.serieses || []).map(d => ({
             name: xAxis.column.type === 'time' ? (moment(d.name).isValid() ? moment(d.name).format('YYYY-MM-DD') : d.name) : d.name,
             key: yAxis.column.label,
             value: yAxis.column.type === 'time' ? (moment(d.value).isValid() ? moment(d.value).format('YYYY-MM-DD') : d.value) : d.value,