(ecModel: GlobalModel, api: ExtensionAPI)
| 34 | export const themeRiverLayoutStageHandler = createSimpleOverallStageHandler(SERIES_TYPE_THEME_RIVER, themeRiverLayout); |
| 35 | |
| 36 | function themeRiverLayout(ecModel: GlobalModel, api: ExtensionAPI) { |
| 37 | |
| 38 | ecModel.eachSeriesByType(SERIES_TYPE_THEME_RIVER, function (seriesModel: ThemeRiverSeriesModel) { |
| 39 | |
| 40 | const data = seriesModel.getData(); |
| 41 | |
| 42 | const single = seriesModel.coordinateSystem; |
| 43 | |
| 44 | const layoutInfo = {} as ThemeRiverLayoutInfo; |
| 45 | |
| 46 | // use the axis boundingRect for view |
| 47 | const rect = single.getRect(); |
| 48 | |
| 49 | layoutInfo.rect = rect; |
| 50 | |
| 51 | const boundaryGap = seriesModel.get('boundaryGap'); |
| 52 | |
| 53 | const axis = single.getAxis(); |
| 54 | |
| 55 | layoutInfo.boundaryGap = boundaryGap; |
| 56 | |
| 57 | if (axis.orient === 'horizontal') { |
| 58 | boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.height); |
| 59 | boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.height); |
| 60 | const height = rect.height - boundaryGap[0] - boundaryGap[1]; |
| 61 | doThemeRiverLayout(data, seriesModel, height); |
| 62 | } |
| 63 | else { |
| 64 | boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], rect.width); |
| 65 | boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], rect.width); |
| 66 | const width = rect.width - boundaryGap[0] - boundaryGap[1]; |
| 67 | doThemeRiverLayout(data, seriesModel, width); |
| 68 | } |
| 69 | |
| 70 | data.setLayout('layoutInfo', layoutInfo); |
| 71 | }); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * The layout information about themeriver |
nothing calls this directly
no test coverage detected
searching dependent graphs…