소스 검색

get label and color from series

corpglory-dev 7 년 전
부모
커밋
7bb996203f
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      public/app/plugins/panel/piechart/PiechartPanel.tsx

+ 5 - 6
public/app/plugins/panel/piechart/PiechartPanel.tsx

@@ -25,17 +25,16 @@ export class PiechartPanel extends PureComponent<Props> {
         nullValueMode: NullValueMode.Null,
       });
 
-      vmSeries.forEach(serie => {
+      for (let i = 0; i < vmSeries.length; i++) {
+        const serie = vmSeries[i];
         if (serie) {
           datapoints.push({
             value: serie.stats[valueOptions.stat],
-            // TODO: get name
-            name: 'tmpName',
-            // TODO: add color option
-            color: 'tmpColor',
+            name: serie.label,
+            color: serie.color,
           });
         }
-      });
+      }
     }
     // TODO: support table data