Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用自定义图表类型的时候,renderItem函数好像没有执行啊! #58

Open
qduck opened this issue Dec 14, 2019 · 1 comment

Comments

@qduck
Copy link

qduck commented Dec 14, 2019

chartOption2: {
tooltip: {
formatter: function (params) {
return params.marker + params.name + ': ' + params.value[3] + ' ms';
}
},
title: {
text: '供应商来料到货情况'
},
dataZoom: [{
type: 'slider',
filterMode: 'weakFilter',
showDataShadow: false,
top: 400,
height: 10,
borderColor: 'transparent',
backgroundColor: '#e2e2e2',
handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z', // jshint ignore:line
handleSize: 20,
handleStyle: {
shadowBlur: 6,
shadowOffsetX: 1,
shadowOffsetY: 2,
shadowColor: '#aaa'
},
labelFormatter: ''
}, {
type: 'inside',
filterMode: 'weakFilter'
}],
xAxis: {
min: 0,
max: 1440,
scale: true,
interval: 60,
axisLabel: {
formatter: function (val) {
return Math.round(val / 60) + 'h';
}
}
},
yAxis: {
data: ['机房工地模块', '厅门轿门工地模块', '轿底吊顶工地模块', '直梁工地模块', '底坑工地模块', '补偿链工地模块', '操纵箱工地模块']
},
series: [{
type: 'custom',
renderItem: function (params, api) {
var categoryIndex = api.value(0);

                    var start = api.coord([api.value(1), categoryIndex]);
                    var end = api.coord([api.value(2), categoryIndex]);
                    var height = api.size([0, 1])[1] * 0.6;

                    var rectShape = echarts.graphic.clipRectByRect({
                        x: start[0],
                        y: start[1] - height / 2,
                        width: end[0] - start[0],
                        height: height
                    }, {
                            x: params.coordSys.x,
                            y: params.coordSys.y,
                            width: params.coordSys.width,
                            height: params.coordSys.height
                        });

                    return rectShape && {
                        type: 'rect',
                        shape: rectShape,
                        style: api.style()
                    };
                },
                itemStyle: {
                    normal: {
                        opacity: 0.8
                    }
                },
                encode: {
                    x: [1, 2],
                    y: 0
                },
                data: [{
                    name: "test1",
                    value: [
                        1,
                        100,
                        230, 122
                    ],
                    itemStyle: {
                        normal: {
                            color: '#0077FF'
                        }
                    }
                }]
            }]
        }
@qduck
Copy link
Author

qduck commented Dec 15, 2019

"react-native": "0.58.0",
"react-native-secharts": "^1.6.1",
"react-native-webview": "^2.14.3",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant