Javascript 缺少反应D3折线图工具提示
下面是我们用来显示折线图的代码。但是,我们没有看到工具提示被启用。有什么建议吗?抱歉,新的反应框架。面积图的类似代码适用于工具提示Javascript 缺少反应D3折线图工具提示,javascript,reactjs,d3.js,charts,Javascript,Reactjs,D3.js,Charts,下面是我们用来显示折线图的代码。但是,我们没有看到工具提示被启用。有什么建议吗?抱歉,新的反应框架。面积图的类似代码适用于工具提示 import React, { Component } from 'react'; import D3Chart from '../area/D3Chart'; import DataUtils from '../../utils/DataUtils'; export default class LineChart extends Component {
import React, { Component } from 'react';
import D3Chart from '../area/D3Chart';
import DataUtils from '../../utils/DataUtils';
export default class LineChart extends Component {
xTicksFormat(d) {
if (this.props.xMappingData) {
let retVal = DataUtils.findMapping(this.props.xMappingData, d-1);
if (retVal)
return retVal;
else
return '';
}
else if (this.props.xMappingData2) {
let retVal = DataUtils.findMapping2(this.props.xMappingData2, d);
if (retVal)
return retVal;
}
else
return d;
}
yTicksFormat(d) {
return d;
}
render(){
var data= this.props.data;
var margin={
top: 50, right: 30, bottom: 50, left: 50
};
return(
<div className="row outerbox bigChart">
<div className="col-md-12 custom_padding" >
<D3Chart data={data} xData="x" yData="y" margin={margin} interpolations="basis" xMaxBuffer={-30}
yMaxBuffer={20} id="line-chart" width={480} height={400} type="line">
<yGrid orient="left" className="y-grid" ticks={12} title={data.yTitle} ticksFormat={this.yTicksFormat.bind(this)}/>
<xGrid orient="bottom" className="x-grid" ticks={5} title={data.xTitle} ticksFormat={this.xTicksFormat.bind(this)}/>
<line />
<path className="line shadow" strokeLinecap="round"/>
<tooltip textStyle1="tooltip-text1"
textStyle2="tooltip-text1" bgStyle="tooltip-bg"
xValue="Date" yValue="Count"/>
{/*<axisTitle text={data.xTitle} axisType='x' />
<axisTitle text={data.yTitle} axisType='y'/> */}
</D3Chart>
</div>
<span className="chartPadding"></span>
</div>
);
}
}
import React,{Component}来自'React';
从“../area/D3Chart”导入D3Chart;
从“../../utils/DataUtils”导入数据utils;
导出默认类折线图扩展组件{
xTicksFormat(d){
if(this.props.xMappingData){
让retVal=DataUtils.findMapping(this.props.xMappingData,d-1);
如果(返回)
返回返回;
其他的
返回“”;
}
else if(this.props.xMappingData2){
让retVal=DataUtils.findMapping2(this.props.xMappingData2,d);
如果(返回)
返回返回;
}
其他的
返回d;
}
yTicksFormat(d){
返回d;
}
render(){
var数据=this.props.data;
var保证金={
顶部:50,右侧:30,底部:50,左侧:50
};
返回(
{/*
*/}
);
}
}