使用react-vis的动态列的垂直分组条形图

时间:2019-01-16 13:05:08

标签: reactjs d3.js charts react-vis

使用react-vis的动态列的垂直分组条形图

使用react-vis竖线的输出

enter image description here

预期产量

enter image description here

<XYPlot
                        xType={chartData['type']}
                        width={width}
                        height={height}>
                        <VerticalGridLines style={gridLineStyle} />
                        <HorizontalGridLines style={gridLineStyle} />
                        <XAxis tickLabelAngle={xAxisAngle} style={tickStyle} tickFormat={chartData['type'] == 'linear' ? tick => this.formatNumber(tick) : null} />
                        <YAxis tickLabelAngle={yAxisAngle} style={tickStyle} tickFormat={tick => this.formatNumber(tick)} />
                        <ChartLabel
                            text={chartData['name']}
                            className="alt-x-label"
                            includeMargin={false}
                            xPercent={0.5}
                            yPercent={1.18}
                            style={{
                                fontWeight: 'bold',
                                textAnchor: 'middle',
                                fontSize: "12px",
                                fill: "#6b6b76",
                                fontFamily: "sans-serif"
                            }}
                        />
                        <ChartLabel
                            text={'No. of variants'}
                            className="alt-y-label"
                            includeMargin={false}
                            xPercent={-0.02}
                            yPercent={0.5}
                            style={{
                                transform: 'rotate(-90)',
                                fontWeight: 'bold',
                                textAnchor: 'middle',
                                fontSize: "12px",
                                fill: "#6b6b76",
                                fontFamily: "sans-serif"
                            }}
                        />
                        {hoveredNode && (
                            <Hint value={hoveredNode}>
                                <div style={{ background: '#000000' }}>
                                    <p style={{ fontSize: "10px", padding: "3px", color: '#ffffff' }}>{`${hoveredNode.y} variants with ${chartData['name']} of ${hoveredNode.x}`}</p>
                                </div>
                            </Hint>
                        )}
                        <BarSeries data={A} />
                        <BarSeries data={C} />
                        <BarSeries data={G} />
                        <BarSeries data={T} />
                    </XYPlot>

我得到三个3小节,但总是有四分之一的空白小节。不需要。任何建议都会有所帮助。谢谢

0 个答案:

没有答案