1

Removing credits from standard anycharts is well documented here:

var credits = chart.credits();
credits.enabled(false);

What's the easiest way of going about this with the AnyChart-React library, I can see nothing documented?

Thanks.

4

4 回答 4

1

如果您不在 AnyChart 组件上使用实例属性 - 所有属性(保留的除外)都将在图表上调用,就像它是 JS API 一样(请参阅组件用法)。因此,如果您想关闭 credits,请将 credits 属性设置为 false:( <AnyChart credits={false} />相当于chart.credits(false)

于 2017-06-13T02:40:44.637 回答
1

您可以访问anychart的实例,然后调用credits函数,如下所示:

componentDidMount() {
  const credits = this.anyChart.instance.credits();
  credits.enabled(false);
}
    
render() {
  return <AnyChart ref={(ref) => { this.anyChart = ref; }} />;
}

于 2017-06-12T10:22:47.833 回答
0

那不是很明显,也没有在文档中解释。我已成功设置 AnyChart React 组件的许可证密钥并隐藏积分,请参阅下面的代码。

import React from 'react'

import AnyChart from 'anychart-react'

export class DonutChart extends React.Component {

    constructor (props) {
        super(props)
        window.anychart.licenseKey('YOUR-KEY-HERE')
    }

    render() {
        return(

        <div className="sixteen wide column" style={{ padding: "30px 20px 0px 20px" }}>

            <AnyChart
                type = "pie"
                data = { [1, 2, 3, 4] }
                title = "Simple pie chart"
                credits={false}
            />

        </div>

        )
    }

}

export default DonutChart
于 2018-08-30T10:46:06.710 回答
0

只需将以下内容放入您的CSS:

.anychart-credits {
   display: none;
}
于 2017-07-11T18:06:51.463 回答