mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
更新FAQ
This commit is contained in:
@@ -1,142 +1,168 @@
|
||||
# XCharts FAQ
|
||||
|
||||
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
|
||||
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
|
||||
[QA 3: How to customize the color of data item in line chart and pie chart?](#How-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[QA 4: How to formatter the text of axis label, such as add a units text?](#How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[QA 5: How to stack the bar of bar chart](#How-to-stack-the-bar-of-bar-chart)
|
||||
[QA 6: How to make the bar serie in the same bar but not stack?](#How-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[QA 7: How to adjust the bar width and gap of barchart?](#How-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[QA 8: How to adjust the color of bar?](#How-to-adjust-the-color-of-bar)
|
||||
[QA 9: Can I adjust the anchor of chart?](#Can-I-adjust-the-anchor-of-chart)
|
||||
[QA 10: Can display more than 1000 data?](#Can-display-more-than-1000-data)
|
||||
[QA 11: Can line chart drawing be dash, dot and dash-dot?](#Can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[QA 12: How to limit the value range of the Y-axis?](#How-to-limit-the-value-range-of-the-Y-axis)
|
||||
[QA 13: How to customize the tick value range of value axis?](#How-to-customize-the-tick-value-range-of-value-axis)
|
||||
[QA 14: How to display text at the top of data items?](#How-to-display-text-at-the-top-of-data-items)
|
||||
[QA 15: How do I customize icons for data items?](#How-do-I-customize-icons-for-data-items)
|
||||
[QA 16: How to anti-aliasing and make the chart smoother?](#How-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[QA 17: Why does mouse over chart Tooltip not show?](#Why-does-mouse-over-chart-Tooltip-not-show)
|
||||
[QA 18: How not to display the bar line of Tooltip?](#How-not-to-display-the-bar-line-of-Tooltip)
|
||||
[QA 19: How do I customize the display of Tooltip?](#How-do-I-customize-the-display-of-Tooltip)
|
||||
[QA 20: How do I get the Y-axis to display multiple decimal places?](#How-do-I-get-the-Y-axis-to-display-multiple-decimal-places)
|
||||
[QA 21: How do I dynamically update data with code?](#How-do-I-dynamically-update-data-with-code)
|
||||
[QA 22: How to display legend? Why are legends sometimes not displayed?](#How-to-display-legend?Why-are-legends-sometimes-not-displayed)
|
||||
[QA 23: How to make chart as prefab?](#How-to-make-chart-as-prefab)
|
||||
[QA 24: How do I draw custom graphic in chart,such as line or dot?](#How-do-I-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[QA 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram)
|
||||
[QA 26: How do I use the background component? What are the conditions?](#How-do-I-use-the-background-component-What-are-the-conditions)
|
||||
[QA 27: Mesh can not have more than 65000 vertices?](#Mesh-cannot-have-more-than-65000-vertices)
|
||||
[QA 28: Why are the parameters set in Serie reset after they run?](#Why-are-the-parameters-set-in-Serie-reset-after-they-run)
|
||||
[FAQ 1: How to adjust the margin between the axis and the background?](#how-to-adjust-the-margin-between-the-axis-and-the-background)
|
||||
[FAQ 2: How to play agian the fadeIn animation?](#how-to-play-agian-the-fadein-animation)
|
||||
[FAQ 3: How to customize the color of data item in line chart and pie chart?](#how-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[FAQ 4: How to formatter the text of axis label, such as add a units text?](#how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[FAQ 5: How to stack the bar of bar chart](#how-to-stack-the-bar-of-bar-chart)
|
||||
[FAQ 6: How to make the bar serie in the same bar but not stack?](#how-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[FAQ 7: How to adjust the bar width and gap of barchart?](#how-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[FAQ 8: How to adjust the color of bar?](#how-to-adjust-the-color-of-bar)
|
||||
[FAQ 9: Can I adjust the anchor of chart?](#can-i-adjust-the-anchor-of-chart)
|
||||
[FAQ 10: Can display more than 1000 data?](#can-display-more-than-1000-data)
|
||||
[FAQ 11: Can line chart drawing be dash, dot and dash-dot?](#can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[FAQ 12: How to limit the value range of the Y-axis?](#how-to-limit-the-value-range-of-the-y-axis)
|
||||
[FAQ 13: How to customize the tick value range of value axis?](#how-to-customize-the-tick-value-range-of-value-axis)
|
||||
[FAQ 14: How to display text at the top of data items?](#how-to-display-text-at-the-top-of-data-items)
|
||||
[FAQ 15: How do I customize icons for data items?](#how-do-i-customize-icons-for-data-items)
|
||||
[FAQ 16: How to anti-aliasing and make the chart smoother?](#how-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[FAQ 17: Why does mouse over chart Tooltip not show?](#why-does-mouse-over-chart-tooltip-not-show)
|
||||
[FAQ 18: How not to display the bar line of Tooltip?](#how-not-to-display-the-bar-line-of-tooltip)
|
||||
[FAQ 19: How do I customize the display of Tooltip?](#how-do-i-customize-the-display-of-tooltip)
|
||||
[FAQ 20: How do I get the Y-axis to display multiple decimal places?](#how-do-i-get-the-y-axis-to-display-multiple-decimal-places)
|
||||
[FAQ 21: How do I dynamically update data with code?](#how-do-i-dynamically-update-data-with-code)
|
||||
[FAQ 22: How to display legend? Why are legends sometimes not displayed?](#how-to-display-legend-why-are-legends-sometimes-not-displayed)
|
||||
[FAQ 23: How to make chart as prefab?](#how-to-make-chart-as-prefab)
|
||||
[FAQ 24: How do I draw custom graphic in chart,such as line or dot?](#how-do-i-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[FAQ 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#how-to-achieve-similar-data-movement-effect-of-electro-cardiogram)
|
||||
[FAQ 26: How do I use the background component? What are the conditions?](#how-do-i-use-the-background-component-what-are-the-conditions)
|
||||
[FAQ 27: Mesh can not have more than 65000 vertices?](#mesh-cannot-have-more-than-65000-vertices)
|
||||
[FAQ 28: Why are the parameters set in Serie reset after they run?](#why-are-the-parameters-set-in-serie-reset-after-they-run)
|
||||
[FAQ 29: How to change the color of serie symbol?](#how-to-change-the-color-of-serie-symbol)
|
||||
[FAQ 30: How to deal with TMP errors when importing or updating XCharts?](#what-if-tmp-errors-occur-when-importing-or-updating-xcharts)
|
||||
[FAQ 31: Support empty data? How to achieve the effect of line chart disconnection?](#support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection)
|
||||
[FAQ 32: 2.x What are the common problems when upgrading version 3.x?](#what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3)
|
||||
|
||||
## How-to-adjust-the-margin-between-the-axis-and-the=-background
|
||||
## how-to-adjust-the-margin-between-the-axis-and-the-background
|
||||
|
||||
A: `Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
`Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
|
||||
## How-to-play-agian-the-fadeIn-animation
|
||||
## how-to-play-agian-the-fadein-animation
|
||||
|
||||
A: call the `chart.AnimationReset()` API.
|
||||
call the `chart.AnimationReset()` API.
|
||||
|
||||
## How-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
## how-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
|
||||
A: `Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
`Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
|
||||
## How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
## how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
|
||||
A: Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
|
||||
## How-to-stack-the-bar-of-bar-chart
|
||||
## how-to-stack-the-bar-of-bar-chart
|
||||
|
||||
A: Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
|
||||
## How-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
## how-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
|
||||
A: Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
|
||||
## How-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
## how-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
|
||||
A: Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
|
||||
## How-to-adjust-the-color-of-bar
|
||||
## how-to-adjust-the-color-of-bar
|
||||
|
||||
A: Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
|
||||
## Can-I-adjust-the-anchor-of-chart
|
||||
## can-i-adjust-the-anchor-of-chart
|
||||
|
||||
A: Yes, you can set any one of 16 anchors but the value use default.
|
||||
Yes, you can set any one of 16 anchors but the value use default.
|
||||
|
||||
## Can-display-more-than-1000-data
|
||||
## can-display-more-than-1000-data
|
||||
|
||||
A: Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
|
||||
## Can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
## can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
|
||||
A: Yes. Adjust the `lineType` of `Serie`.
|
||||
Yes. Adjust the `lineType` of `Serie`.
|
||||
|
||||
## How-to-limit-the-value-range-of-the-Y-axis
|
||||
## how-to-limit-the-value-range-of-the-y-axis
|
||||
|
||||
A: Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
|
||||
## How-to-customize-the-tick-value-range-of-value-axis
|
||||
## how-to-customize-the-tick-value-range-of-value-axis
|
||||
|
||||
A: By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
|
||||
## How-to-display-text-at-the-top-of-data-items
|
||||
## how-to-display-text-at-the-top-of-data-items
|
||||
|
||||
A: Adjust the `Label` of `Serie`.
|
||||
Adjust the `Label` of `Serie`.
|
||||
|
||||
## How-do-I-customize-icons-for-data-items
|
||||
## how-do-i-customize-icons-for-data-items
|
||||
|
||||
A: Set the `Icon` of `Data` in `Serie`.
|
||||
Set the `Icon` of `Data` in `Serie`.
|
||||
|
||||
## How-to-anti-aliasing-and-make-the-chart-smoother
|
||||
## how-to-anti-aliasing-and-make-the-chart-smoother
|
||||
|
||||
A: Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
|
||||
## Why-does-mouse-over-chart-Tooltip-not-show
|
||||
## why-does-mouse-over-chart-tooltip-not-show
|
||||
|
||||
A: Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
|
||||
## How-not-to-display-the-bar-line-of-Tooltip
|
||||
## how-not-to-display-the-bar-line-of-tooltip
|
||||
|
||||
A: Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
|
||||
## How-do-I-customize-the-display-of-Tooltip
|
||||
## how-do-i-customize-the-display-of-tooltip
|
||||
|
||||
A: See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
|
||||
## How-do-I-get-the-Y-axis-to-display-multiple-decimal-places
|
||||
## how-do-i-get-the-y-axis-to-display-multiple-decimal-places
|
||||
|
||||
A: Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
|
||||
## How-do-I-dynamically-update-data-with-code
|
||||
## how-do-i-dynamically-update-data-with-code
|
||||
|
||||
A: See example: `Example01_UpdateData.cs`
|
||||
See example: `Example01_UpdateData.cs`
|
||||
|
||||
## How-to-display-legend?Why-are-legends-sometimes-not-displayed
|
||||
## how-to-display-legend-why-are-legends-sometimes-not-displayed
|
||||
|
||||
A: First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
|
||||
## How-to-make-chart-as-prefab
|
||||
## how-to-make-chart-as-prefab
|
||||
|
||||
A: Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
|
||||
## How-do-I-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
## how-do-i-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
|
||||
A: Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
|
||||
## How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram
|
||||
## how-to-achieve-similar-data-movement-effect-of-electro-cardiogram
|
||||
|
||||
A: See `Example_Dynamic.cs`.
|
||||
See `Example_Dynamic.cs`.
|
||||
|
||||
## How-do-I-use-the-background-component-What-are-the-conditions
|
||||
## how-do-i-use-the-background-component-what-are-the-conditions
|
||||
|
||||
A: Setting `show` to `true` for the `background` component.
|
||||
Setting `show` to `true` for the `background` component.
|
||||
|
||||
## Mesh-cannot-have-more-than-65000-vertices
|
||||
## mesh-cannot-have-more-than-65000-vertices
|
||||
|
||||
A: This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [QA 10: Can display more than 1000 data](#Can-display-more-than-1000-data)
|
||||
This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [FAQ 10: Can display more than 1000 data](#can-display-more-than-1000-data)
|
||||
|
||||
## Why-are-the-parameters-set-in-Serie-reset-after-they-run
|
||||
## why-are-the-parameters-set-in-serie-reset-after-they-run
|
||||
|
||||
A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
|
||||
## how-to-change-the-color-of-serie-symbol
|
||||
|
||||
The color of 'Symbol' is the color of 'ItemStyle' used.
|
||||
|
||||
## what-if-tmp-errors-occur-when-importing-or-updating-xcharts
|
||||
|
||||
XCharts does not enable TMP by default, so there are no references to TMP on asmdef. This issue may occur when updating XCharts after TMP is enabled locally. It can be solved in the following two ways:
|
||||
|
||||
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef` and manually add references to `TextMeshPro`
|
||||
2. Remove the `dUI_TextMeshPro` macro for Scripting Define Symbols in PlayerSetting
|
||||
|
||||
Version ` 3.8.0 ` after adding Daemon [XCharts - Daemon](https://github.com/XCharts-Team/XCharts-Daemon), will be XCharts - Daemon import project, When updating XCharts, the daemon automatically refreshes the asmdef based on the locally enabled TMP to ensure proper compilation.
|
||||
|
||||
## support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection
|
||||
|
||||
`data` of `Serie` is of type `double`, so it cannot represent empty data. Empty data can be achieved by turning on Serie's ignore and specifying ignoreValue. You can also set the ignore parameter for each SerieData. The ignoreLineBreak parameter can be set to disconnect or connect after ignoring data.
|
||||
|
||||
## what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3
|
||||
|
||||
1. `XCharts.Runtime.XChartsMgr` is missing the class attribute `ExtensionOfNativeClass`!
|
||||
3.x version does not need to mount XChartsMgr, directly delete the `_xcharts_` node on the scene.
|
||||
|
||||
@@ -5,161 +5,163 @@ slug: /faq
|
||||
|
||||
# 常见问题
|
||||
|
||||
[QA 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[QA 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[QA 3:如何自定义折线图饼图的颜色?](#如何自定义折线图饼图的颜色)
|
||||
[QA 4:如何给坐标轴上的文本加上单位?](#如何给坐标轴上的文本加上单位)
|
||||
[QA 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[QA 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[QA 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[QA 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[QA 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[QA 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线点线点划线吗)
|
||||
[QA 12:如何限定Y轴的值范围?](#如何限定Y轴的值范围)
|
||||
[QA 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[QA 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[QA 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[QA 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重如何让图表更顺滑)
|
||||
[QA 17:为什么鼠标移上图表 Tooltip 不显示?](#为什么鼠标移上图表Tooltip不显示)
|
||||
[QA 18:如何取消 Tooltip 的竖线?](#如何取消Tooltip的竖线)
|
||||
[QA 19:如何自定义 Tooltip 的显示内容?](#如何自定义Tooltip的显示内容)
|
||||
[QA 20:如何让Y轴显示多位小数?](#如何让Y轴显示多位小数)
|
||||
[QA 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[QA 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例为什么有时候图例无法显示)
|
||||
[QA 23:如何做成预设?](#如何做成预设)
|
||||
[QA 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[QA 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[QA 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件有什么条件限制)
|
||||
[QA 27:Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
|
||||
[QA 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[QA 29:如何修改Serie的Symbol的颜色?](#如何修改Serie的Symbol的颜色)
|
||||
[QA 30:导入或更新XCharts时TMP报错如何处理?](#导入或更新XCharts时TMP报错怎么办)
|
||||
[QA 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
|
||||
[FAQ 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[FAQ 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[FAQ 3:如何自定义折线图饼图的颜色?](#如何自定义折线图饼图的颜色)
|
||||
[FAQ 4:如何给坐标轴上的文本加上单位?](#如何给坐标轴上的文本加上单位)
|
||||
[FAQ 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[FAQ 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[FAQ 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[FAQ 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[FAQ 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[FAQ 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线点线点划线吗)
|
||||
[FAQ 12:如何限定Y轴的值范围?](#如何限定y轴的值范围)
|
||||
[FAQ 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[FAQ 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[FAQ 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[FAQ 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重如何让图表更顺滑)
|
||||
[FAQ 17:为什么鼠标移上图表Tooltip不显示?](#为什么鼠标移上图表tooltip不显示)
|
||||
[FAQ 18:如何取消Tooltip的竖线?](#如何取消tooltip的竖线)
|
||||
[FAQ 19:如何自定义Tooltip的显示内容?](#如何自定义tooltip的显示内容)
|
||||
[FAQ 20:如何让y轴显示多位小数?](#如何让y轴显示多位小数)
|
||||
[FAQ 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[FAQ 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例为什么有时候图例无法显示)
|
||||
[FAQ 23:如何做成预设?](#如何做成预设)
|
||||
[FAQ 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[FAQ 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[FAQ 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件有什么条件限制)
|
||||
[FAQ 27:Mesh can not have more than 65000 vertices?](#mesh_cannot_have_more_than_65000_vertices)
|
||||
[FAQ 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[FAQ 29:如何修改serie的symbol的颜色?](#如何修改serie的symbol的颜色)
|
||||
[FAQ 30:导入或更新XCharts时TMP报错如何处理?](#导入或更新xcharts时tmp报错怎么办)
|
||||
[FAQ 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
|
||||
[FAQ 32:2.x版本升级3.x版本时常见的问题有哪些?](2.x版本升级3.x版本时常见的问题有哪些)
|
||||
[FAQ 33:折线图如何两边不留空白而从0坐标开始显示?](折线图如何两边不留空白而从0坐标开始显示)
|
||||
|
||||
## 如何调整坐标轴与背景的边距
|
||||
|
||||
答:调整`Grid`组件,可调整上下左右边距。
|
||||
调整`Grid`组件,可调整上下左右边距。
|
||||
|
||||
## 如何让初始动画重新播放
|
||||
|
||||
答:调用`chart.AnimationReset()`接口。
|
||||
调用`chart.AnimationReset()`接口。
|
||||
|
||||
## 如何自定义折线图饼图的颜色
|
||||
|
||||
答:通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
|
||||
## 如何给坐标轴上的文本加上单位
|
||||
|
||||
答:通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
|
||||
## 如何让柱形图的柱子堆叠显示
|
||||
|
||||
答:设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
|
||||
## 如何让柱形图的柱子同柱但不重叠
|
||||
|
||||
答:设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
|
||||
## 如何调整柱形图的柱子宽度和间距
|
||||
|
||||
答:调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
|
||||
## 如何调整柱形图单个柱子的颜色
|
||||
|
||||
答:可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
|
||||
## 如何调整图表的对齐方式
|
||||
|
||||
答:调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
|
||||
## 可以显示超过1000以上的大数据吗
|
||||
|
||||
答:可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
|
||||
## 折线图可以画虚线点线点划线吗
|
||||
|
||||
答:可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
|
||||
## 如何限定Y轴的值范围
|
||||
## 如何限定y轴的值范围
|
||||
|
||||
答:设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
|
||||
## 如何自定义数值轴刻度大小
|
||||
|
||||
答:默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
|
||||
## 如何在数据项顶上显示文本
|
||||
|
||||
答:通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
|
||||
## 如何给数据项自定义图标
|
||||
|
||||
答:通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
|
||||
## 锯齿太严重如何让图表更顺滑
|
||||
|
||||
答:开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
|
||||
## 为什么鼠标移上图表Tooltip不显示
|
||||
## 为什么鼠标移上图表tooltip不显示
|
||||
|
||||
答:确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
|
||||
## 如何取消Tooltip的竖线
|
||||
## 如何取消tooltip的竖线
|
||||
|
||||
答:设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
|
||||
## 如何自定义Tooltip的显示内容
|
||||
## 如何自定义tooltip的显示内容
|
||||
|
||||
答:自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
|
||||
自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
|
||||
|
||||
## 如何让Y轴显示多位小数
|
||||
## 如何让y轴显示多位小数
|
||||
|
||||
答:设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
|
||||
## 如何用代码动态更新数据
|
||||
|
||||
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
|
||||
## 如何显示图例为什么有时候图例无法显示
|
||||
|
||||
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
|
||||
## 如何做成预设
|
||||
|
||||
答:做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
|
||||
## 如何在图表上画点画线等自定义内容
|
||||
|
||||
答:`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
|
||||
## 如何实现心电图类似的数据移动效果
|
||||
|
||||
答:参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
|
||||
## 如何使用背景组件有什么条件限制
|
||||
|
||||
答:设置`background`组件的`show`为`true`。
|
||||
设置`background`组件的`show`为`true`。
|
||||
|
||||
## 区域折线图在用半透明颜色时有时候会一条叠加的线
|
||||
|
||||
答:这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
|
||||
## Mesh_cannot_have_more_than_65000_vertices
|
||||
## mesh_cannot_have_more_than_65000_vertices
|
||||
|
||||
答:这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
|
||||
## 为什么serie里设置的参数运行后又被重置了
|
||||
|
||||
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
|
||||
## 如何修改Serie的Symbol的颜色
|
||||
## 如何修改serie的symbol的颜色
|
||||
|
||||
答:`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
|
||||
## 导入或更新XCharts时TMP报错怎么办
|
||||
## 导入或更新xcharts时tmp报错怎么办
|
||||
|
||||
答:XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
@@ -168,4 +170,13 @@ slug: /faq
|
||||
|
||||
## 支持空数据吗如何实现折线图断开的效果
|
||||
|
||||
答:`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
|
||||
## 2.x版本升级3.x版本时常见的问题有哪些
|
||||
|
||||
1. 'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!
|
||||
3.x版本时不需要挂载XChartsMgr,直接删掉场景上的`_xcharts_`节点即可。
|
||||
|
||||
## 折线图如何两边不留空白而从0坐标开始显示
|
||||
|
||||
设置X轴的`boundaryGap`参数。
|
||||
|
||||
Reference in New Issue
Block a user