我react-google-chart
用于以图形形式(条形图)显示我的数据,根据要求我必须制作一个dual-y-axis chart
我已经制作了该图表,但问题是该图表没有占用options
. Bar
当我放置图表时它是一个图表,ColumnChart
然后它正在接受选项但不呈现dual-y-axis-chart
,如果我将Bar
其作为图表类型,它不接受选项
我错过了什么?这是我的代码:
import React from "react";
import ReactDOM from "react-dom";
import Chart from "react-google-charts";
const data = [
["Month", "CTC", "Gross Salary", "Variation of CTC", "Total No of Employes"],
["Jan", 35000, 27000, 10000, 3],
["feb", 30000, 24000, 8000, 4],
["Mar", 50000, 37000, 7000, 5],
["May", 20000, 17000, 5000, 6],
["June", 20000, 17000, 5000, 5],
["July", 20000, 17000, 5000, 10],
["August", 20000, 17000, 5000, 7],
["Sep", 20000, 17000, 5000, 5],
["Nov", 20000, 17000, 5000, 5],
["Dec", 20000, 17000, 5000, 9]
];
const options = {
width: 900,
title: "Nearby galaxies",
curveType: "function",
series: {
3: {
axis: "test"
}
},
legend: { position: "bottom" }
};
class App extends React.Component {
render() {
return (
<div className="App">
<Chart
chartType="Bar"
width="100%"
height="400px"
data={data}
options={options}
legendToggle
/>
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
工作示例
编辑
我什至不采取chartEvent
任何方式来实现这些目标,如果不是 react-google-chart 那么我对任何开源图表库开放的任何其他库。