我正在使用 chart.js v.2。库,当用户将鼠标悬停在图表点上时,我试图将光标样式更改为“指针”。(我将把它用于条形图、饼图、折线图)。似乎 charts.js v.2 中应该支持此选项。但我在任何地方都找不到例子。
编辑:我没有提到我使用的是带有反应的图表,更具体地说,我正在使用这个反应包装器。
我正在导入例如图表线 import { Line } from 'react-chartjs-2';
class ChartTimelineChart extends Component {
constructor(props){
super(props);
this.options = {
responsive: true,
maintainAspectRatio: false,
animation: {
easing: 'easeOutCirc',
duration: 1000
},
pointStyle : 'circle',
scales: {
xAxes: [{
display: true,
gridLines: {display: false},
scaleLabel: {display: true}
}],
yAxes: [{
display: true,
gridLines: {display: false},
ticks: {beginAtZero:true},
scaleLabel: {display: true}
}]
},
tooltips: {
displayColors: false
},
legend: false
};
searchChart(elem, props, data) {
//Something... …
Run Code Online (Sandbox Code Playgroud) 我正在使用“react-virtualized”来创建一个表。在该表中,某些数据可能会显示为'<b>Brian Vaughn1</b>'
。该表格单元格应该font-weight: bold
仅呈现文本,不带标签。像这样:
我已经设法通过使用来解决这个问题ReactDOM.findDOMNode
(据我所知应该避免使用),但我认为应该有一个更好、更干净的方法来做到这一点。这是我的代码:
import React, { Component } from 'react';
import { Column, Table } from 'react-virtualized';
import './chart-table.scss';
class ChartRTable extends Component{
constructor(props){
super(props);
this.handleScroll = this.handleScroll.bind(this);
}
getColumns(data){
const columnsNumber = data.namesForColumns.length;
const columnWidth = this.props.tableWidth / columnsNumber;
let namesForColumns = ['name', 'description'];
return namesForColumns.map( name => {
return (
<Column
label={name}
dataKey={name}
width={columnWidth}
/>
)
})
}
handleScroll(){
// not a very nice way to make use of <b> tags …
Run Code Online (Sandbox Code Playgroud)