@@ -14,6 +14,7 @@ import Big from "big.js";
1414import { googleMapsApiUrl } from "../chartComp/chartConfigs/chartUrls" ;
1515import { chartStyleWrapper , styleWrapper } from "../../util/styleWrapper" ;
1616import parseBackground from "../../util/gradientBackgroundColor" ;
17+ import isColorString from "../../util/isColorString" ;
1718
1819export function transformData (
1920 originData : JSONObject [ ] ,
@@ -135,6 +136,10 @@ export function getEchartsConfig(
135136 chartSize ?: ChartSize ,
136137 theme ?: any ,
137138) : EChartsOptionWithMap {
139+ console . log ( props . echartsOption && props ?. echartsOption ?. data ?. map ( item => ( {
140+ name : item . name ,
141+ itemStyle : item . color && { color : item . color }
142+ } ) ) )
138143 if ( props . mode === "json" ) {
139144 let opt = {
140145 title : {
@@ -148,43 +153,46 @@ export function getEchartsConfig(
148153 backgroundColor : parseBackground (
149154 props ?. chartStyle ?. background || theme ?. chartStyle ?. backgroundColor || "#FFFFFF"
150155 ) ,
151- "tooltip" : props . tooltip && {
152- "trigger" : "item" ,
153- "formatter" : "{a} <br/>{b} : {c}%"
154- } ,
155- "series" : [
156- {
157- "name" : props . echartsConfig . type ,
158- "type" : props . echartsConfig . type ,
159- left : `${ props ?. left } %` ,
160- right : `${ props ?. right } %` ,
161- bottom : `${ props ?. bottom } %` ,
162- top : `${ props ?. top } %` ,
163- "label" : {
164- "show" : true ,
165- "position" : props . echartsLabelConfig . top ,
166- ...styleWrapper ( props ?. detailStyle , theme ?. detailStyle , 15 )
156+ tooltip : props . tooltip && {
157+ trigger : "item" ,
158+ formatter : "{a} <br/>{b} : {c}%"
167159 } ,
168- "data" : props . echartsOption ?. data ?. map ( item => ( { name : item . name , itemStyle : { color : item . color } } ) ) ,
169- "links" :props . echartsOption . links ,
170- emphasis : {
171- focus : props ?. focus ? 'adjacency' : undefined ,
172- } ,
173- lineStyle : {
174- ...chartStyleWrapper ( props ?. lineStyle , theme ?. lineStyle ) ,
175- color : 'gradient' ,
176- curveness : props ?. curveness ,
177- opacity : props ?. opacity ,
178- } ,
179- itemStyle : {
180- ...chartStyleWrapper ( props ?. chartStyle , theme ?. chartStyle ) ,
181- } ,
182- nodeWidth : props ?. nodeWidth ,
183- nodeGap : props ?. nodeGap ,
184- draggable : props ?. draggable ,
160+ series : [
161+ {
162+ name : props . echartsConfig . type ,
163+ type : props . echartsConfig . type ,
164+ left : `${ props ?. left } %` ,
165+ right : `${ props ?. right } %` ,
166+ bottom : `${ props ?. bottom } %` ,
167+ top : `${ props ?. top } %` ,
168+ label : {
169+ show : true ,
170+ position : props . echartsLabelConfig . top ,
171+ ...styleWrapper ( props ?. detailStyle , theme ?. detailStyle , 15 )
172+ } ,
173+ data : props . echartsOption && props ?. echartsOption ?. data ?. map ( item => ( {
174+ name : item . name ,
175+ itemStyle : isColorString ( item . color ) && { color : item . color }
176+ } ) ) ,
177+ links :props . echartsOption . links ,
178+ emphasis : {
179+ focus : props ?. focus ? 'adjacency' : undefined ,
180+ } ,
181+ lineStyle : {
182+ ...chartStyleWrapper ( props ?. lineStyle , theme ?. lineStyle ) ,
183+ color : 'gradient' ,
184+ curveness : props ?. curveness ,
185+ opacity : props ?. opacity ,
186+ } ,
187+ itemStyle : {
188+ ...chartStyleWrapper ( props ?. chartStyle , theme ?. chartStyle ) ,
189+ } ,
190+ nodeWidth : props ?. nodeWidth ,
191+ nodeGap : props ?. nodeGap ,
192+ draggable : props ?. draggable ,
193+ }
194+ ]
185195 }
186- ]
187- }
188196 return props . echartsOption ? opt : { } ;
189197
190198 }
0 commit comments