鼠标悬停在子弹图上

时间:2018-03-20 13:24:13

标签: javascript html css reactjs

我有这个带有指标的子弹图(满意,不好,目标,措施)。 我想在每个指标中加上一定的值,我的目标是通过鼠标悬停来查看值

这是代码:

         {bulletchartdata.map(
        (item,index)=>{
            return(

        <div className="satisfactory"style={{backgroundColor:'#f2f2f2',height:20,width:item.satisfactoryVal,position:'absolute'}}>           
            <div className="badcolor"style={{backgroundColor:'#d8d6d6',height:20,width:item.badVal,position:'relative'}}></div>
                <div className="target"style={{backgroundColor:'#000000',height:16,width:1,left:item.symbolMarker,position:'relative',top:-18}}></div>
                    <div className="measure"style={{backgroundColor:'#8c8c8c',height:5,width:item.performanceVal,position:'relative',top:-29}}></div>


        </div>

            );

        }
    )}

希望有人能帮我解决问题谢谢:D here is the bullet chart

1 个答案:

答案 0 :(得分:0)

<div id -"new" className="satisfactory"onmouseover = "something()"style={{backgroundColor:'#f2f2f2',height:20,width:item.satisfactoryVal,position:'absolute'}}>

function something(){
    document.getElementbyID("new");
    new.value = "my value"
}

应该尝试一下吗?