如何更改Britecharts中的图表字体大小反应?

发布于 2025-01-24 23:54:53 字数 1042 浏览 2 评论 0原文

我无法使用Britecharts更改X和Y轴的字体大小。 (请参阅 https://britecharts.githarts.githarb.io/britecharts-ritecharts-reacts-react/ >)。从文档看来,该方法是“标签尺寸”,但这目前尚不正常。一个分叉的Codepen显示问题: https://codepen.io of a>。谢谢。

const {Bar} = window['britecharts-react'];
const barData = [
  {
      name: 'Radiating',
      value: 2,
  },
  {
      name: 'Opalescent',
      value: 4,
  },
  {
      name: 'Shining',
      value: 3,
  },
  {
      name: 'Vibrant',
      value: 6,
  },
  {
      name: 'Vivid',
      value: 6,
  },
  {
      name: 'Brilliant',
      value: 1,
  },
];
const marginObject = {
  left: 100,
  right: 40,
  top: 40,
  bottom: 40,
};

ReactDOM.render(
<Bar
  data={barData}
  width={400}
  isHorizontal={true}
  margin={marginObject}
  labelsSize={50}
/>, 
document.getElementById('app')
);

I am unable to change the font-size of the x and y-axis using Britecharts - React. (see https://britecharts.github.io/britecharts-react/#bar). From the docs it seems that the method is "labelsSize" but this is not currently working. A forked codepen showing the issue is here: https://codepen.io/mvolny/pen/XWZrmXR. Thanks.

const {Bar} = window['britecharts-react'];
const barData = [
  {
      name: 'Radiating',
      value: 2,
  },
  {
      name: 'Opalescent',
      value: 4,
  },
  {
      name: 'Shining',
      value: 3,
  },
  {
      name: 'Vibrant',
      value: 6,
  },
  {
      name: 'Vivid',
      value: 6,
  },
  {
      name: 'Brilliant',
      value: 1,
  },
];
const marginObject = {
  left: 100,
  right: 40,
  top: 40,
  bottom: 40,
};

ReactDOM.render(
<Bar
  data={barData}
  width={400}
  isHorizontal={true}
  margin={marginObject}
  labelsSize={50}
/>, 
document.getElementById('app')
);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她比我温柔 2025-01-31 23:54:53

在Brightcharts-Reacter GitHub页面中发现了这一点。基本上,您需要通过CSS来定位图表的元素。请参阅更改字体大小的示例:

.tick text {
  font-size: 16px !important;
}

类似地,

.vertical-grid-line {
display: none !important;
}

Found this out asking around in the Brightcharts-React github page. Basically, you need to target the elements of the chart via css. See example for changing the font-size:

.tick text {
  font-size: 16px !important;
}

similarly,

.vertical-grid-line {
display: none !important;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文