@@ -33,9 +33,9 @@ import {
3333 OptionDataValue ,
3434 BuiltinVisualProperty ,
3535 DimensionIndex ,
36- OptionId ,
3736 ComponentOnCalendarOptionMixin ,
38- ComponentOnMatrixOptionMixin
37+ ComponentOnMatrixOptionMixin ,
38+ OptionId ,
3939} from '../../util/types' ;
4040import ComponentModel from '../../model/Component' ;
4141import Model from '../../model/Model' ;
@@ -93,6 +93,16 @@ export interface VisualMapOption<T extends VisualOptionBase = VisualOptionBase>
9393 */
9494 dimension ?: number
9595
96+ /**
97+ * Series targets with specific dimensions
98+ * When provided, seriesIndex, seriesId, and dimension are ignored
99+ */
100+ seriesTargets ?: {
101+ seriesIndex ?: number
102+ seriesId ?: OptionId
103+ dimension : number
104+ } [ ]
105+
96106 /**
97107 * Visual configuration for the data in selection
98108 */
@@ -247,6 +257,30 @@ class VisualMapModel<Opts extends VisualMapOption = VisualMapOption> extends Com
247257 * @return An array of series indices.
248258 */
249259 protected getTargetSeriesIndices ( ) : number [ ] {
260+ const seriesTargets = this . option . seriesTargets ;
261+ if ( seriesTargets ) {
262+ // When seriesTargets is provided, collect all target series indices
263+ const indices : number [ ] = [ ] ;
264+ each ( seriesTargets , ( target ) => {
265+ if ( target . seriesIndex != null ) {
266+ indices . push ( target . seriesIndex ) ;
267+ }
268+ else if ( target . seriesId != null ) {
269+ // Find series by ID
270+ let seriesModel : SeriesModel ;
271+ this . ecModel . eachSeries ( function ( series ) {
272+ if ( series . id === target . seriesId ) {
273+ seriesModel = series ;
274+ }
275+ } ) ;
276+ if ( seriesModel ) {
277+ indices . push ( seriesModel . componentIndex ) ;
278+ }
279+ }
280+ } ) ;
281+ return indices ;
282+ }
283+
250284 const optionSeriesId = this . option . seriesId ;
251285 let optionSeriesIndex = this . option . seriesIndex ;
252286 if ( optionSeriesIndex == null && optionSeriesId == null ) {
@@ -406,8 +440,23 @@ class VisualMapModel<Opts extends VisualMapOption = VisualMapOption> extends Com
406440 // }
407441 // }
408442
443+ getDimension ( seriesIndex : number ) : number {
444+ const seriesTargets = this . option . seriesTargets ;
445+ if ( seriesTargets ) {
446+ const target = zrUtil . find ( seriesTargets , target =>
447+ ( target . seriesIndex != null && target . seriesIndex === seriesIndex )
448+ || ( target . seriesId != null && target . seriesId === this . ecModel . getSeriesByIndex ( seriesIndex ) . id )
449+ ) ;
450+ if ( target ) {
451+ return target . dimension ;
452+ }
453+ }
454+ return this . option . dimension ;
455+ }
456+
409457 getDataDimensionIndex ( data : SeriesData ) : DimensionIndex {
410- const optDim = this . option . dimension ;
458+ const seriesIndex = ( data . hostModel as any ) . seriesIndex ;
459+ const optDim = this . getDimension ( seriesIndex ) ;
411460
412461 if ( optDim != null ) {
413462 return data . getDimensionIndex ( optDim ) ;
0 commit comments