@visactor/vmind
Version:
<div align="center"> <a href="https://github.com/VisActor#gh-light-mode-only" target="_blank"> <img alt="VisActor Logo" width="200" src="https://github.com/VisActor/.github/blob/main/profile/logo_500_200_light.svg"/> </a> <a href="https://githu
103 lines (97 loc) • 3.38 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.pipelineDualAxis = exports.dualAxisAxes = exports.dualAxisSeries = void 0;
const vutils_1 = require("@visactor/vutils"), constants_1 = require("../constants"), common_1 = require("./common"), chart_advisor_1 = require("@visactor/chart-advisor"), dualAxisSeries = context => {
var _a;
const {cell: cell, spec: spec, simpleVChartSpec: simpleVChartSpec} = context, {color: color} = cell, dataValues = spec.data.values;
return simpleVChartSpec && simpleVChartSpec.series ? (spec.series = simpleVChartSpec.series.map((s => Object.assign(Object.assign({}, s), {
data: {
id: `data_${s.type}`,
values: s.data
},
xField: cell.x,
yField: cell.y[0],
seriesField: color ? (0, vutils_1.isArray)(color) ? color[0] : color : null
}))), {
spec: spec
}) : (spec.series = [ {
type: "bar",
id: constants_1.MAIN_SERIES_ID,
data: {
id: spec.data.id + "_bar",
values: color ? dataValues : dataValues.map((d => Object.assign(Object.assign({}, d), {
[chart_advisor_1.COLOR_FIELD]: cell.y[0]
})))
},
dataIndex: 0,
label: {
visible: !0
},
xField: cell.x,
yField: cell.y[0],
seriesField: color ? (0, vutils_1.isArray)(color) ? color[0] : color : chart_advisor_1.COLOR_FIELD,
bar: {
style: {}
}
}, {
type: "line",
id: constants_1.SUB_SERIES_ID,
dataIndex: 0,
data: {
id: spec.data.id + "_line",
values: color ? dataValues : dataValues.map((d => Object.assign(Object.assign({}, d), {
[chart_advisor_1.COLOR_FIELD]: cell.y[1]
})))
},
label: {
visible: !0
},
xField: cell.x,
yField: cell.y[(null === (_a = cell.y) || void 0 === _a ? void 0 : _a.length) - 1],
seriesField: color ? (0, vutils_1.isArray)(color) ? color[0] : color : chart_advisor_1.COLOR_FIELD,
line: {
style: {}
},
point: {
style: {}
}
} ], spec.data = void 0, spec.labelLayout = "region", {
spec: spec
});
};
exports.dualAxisSeries = dualAxisSeries;
const dualAxisAxes = context => {
const {spec: spec, simpleVChartSpec: simpleVChartSpec} = context;
return simpleVChartSpec && simpleVChartSpec.series || (spec.axes = [ {
id: constants_1.DIMENSION_AXIS_ID,
type: "band",
orient: "bottom"
}, {
id: constants_1.MEASURE_AXIS_LEFT_ID,
seriesId: constants_1.MAIN_SERIES_ID,
type: "linear",
orient: "left",
label: {
style: {}
}
}, {
id: constants_1.MEASURE_AXIS_RIGHT_ID,
seriesId: constants_1.SUB_SERIES_ID,
type: "linear",
orient: "right",
tick: {
visible: !1
},
grid: {
visible: !1
},
label: {
style: {}
}
} ]), {
spec: spec
};
};
exports.dualAxisAxes = dualAxisAxes, exports.pipelineDualAxis = [ common_1.data, common_1.color, exports.dualAxisSeries, exports.dualAxisAxes, common_1.discreteLegend ];
//# sourceMappingURL=dualAxis.js.map