MCPcopy Index your code
hub / github.com/apache/echarts / generateNewSeriesTypes

Method generateNewSeriesTypes

src/component/toolbox/feature/MagicType.ts:108–136  ·  view source on GitHub ↗
(seriesModel: SeriesModel<MegicTypeSeriesOption>)

Source from the content-addressed store, hash-verified

106 series: []
107 };
108 const generateNewSeriesTypes = function (seriesModel: SeriesModel<MegicTypeSeriesOption>) {
109 const seriesType = seriesModel.subType;
110 const seriesId = seriesModel.id;
111 const newSeriesOpt = seriesOptGenreator[type](
112 seriesType, seriesId, seriesModel, model
113 );
114 if (newSeriesOpt) {
115 // PENDING If merge original option?
116 zrUtil.defaults(newSeriesOpt, seriesModel.option);
117 (newOption.series as SeriesOption[]).push(newSeriesOpt);
118 }
119 // Modify boundaryGap
120 const coordSys = seriesModel.coordinateSystem;
121 if (coordSys && coordSys.type === 'cartesian2d' && (type === 'line' || type === 'bar')) {
122 const categoryAxis = coordSys.getAxesByScale('ordinal')[0];
123 if (categoryAxis) {
124 const axisDim = categoryAxis.dim;
125 const axisType = axisDim + 'Axis';
126 const axisModel = seriesModel.getReferringComponents(axisType, SINGLE_REFERRING).models[0];
127 const axisIndex = axisModel.componentIndex;
128
129 newOption[axisType] = newOption[axisType] || [];
130 for (let i = 0; i <= axisIndex; i++) {
131 (newOption[axisType] as any)[axisIndex] = (newOption[axisType] as any)[axisIndex] || {};
132 }
133 (newOption[axisType] as any)[axisIndex].boundaryGap = type === 'bar';
134 }
135 }
136 };
137
138 zrUtil.each(radioTypes, function (radio) {
139 if (zrUtil.indexOf(radio, type) >= 0) {

Callers

nothing calls this directly

Calls 2

getAxesByScaleMethod · 0.45

Tested by

no test coverage detected