问题描述
我正在剪裁我没有数据的时间段。当第一次加载组件时,它工作正常。但是,当我更新数据时,剪辑不起作用。 我正在使用 react-fusioncharts 库
class ChartViewer extends React.Component {
constructor(props) {
super(props);
this.onFetchData = this.onFetchData.bind(this);
this.state = {
timeseriesDs: {
type: "timeseries",renderAt: "chart-container",width: "100%",height: "400",dataSource: {}
}
};
}
componentDidMount() {
this.onFetchData();
}
componentwillReceiveProps() {
this.onFetchData();
}
onFetchData = () => {
const dataFetch = store.getState().rolling.rollingResult['fusion']
console.log(dataFetch)
Promise.all([dataFetch]).then(async res => {
var data = res[0];
var schema = [
{
"name": "Date","type": "date","format": "%Y-%m-%d"
},{
"name": "Type","type": "string"
},{
"name": "Change (%)","type": "number"
}
]
var fusionTable = new FusionCharts.DataStore().createDataTable(
data,schema,);
var myds = {
chart: {
paletteColors: "#d4941e,#75040d,#140947,#8a9615,#9c490b,#15700b",connectNullData: true,},caption: {
text: "Rolling Returns"
},series: "Type",xaxis: {
showclippingcue: 0,autoClipNullData: 'day',autoClipMultiplier: 1,data: fusionTable
}
const timeseriesDs = Object.assign({},this.state.timeseriesDs);
timeseriesDs.dataSource = myds;
this.setState({
timeseriesDs
});
});
}
render() {
return (
<div className="graph-container" style={{ height: "400px" }}>
{this.state.timeseriesDs.dataSource.data ? (
<div>
<ReactFC {...this.state.timeseriesDs} />
</div>
) : (
"loading"
)}
</div>
);
}
}
状态更新前,rolling 为 3。 screenshot1
更新后滚动为10 screenshot2
请帮我解决这个问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)