Merge branch 'master' into 3.0

This commit is contained in:
monitor1394
2024-12-01 22:20:39 +08:00
26 changed files with 553 additions and 318 deletions

View File

@@ -3,7 +3,7 @@ sidebar_position: 41
slug: /api
---
# Chart API
# API
## All Class
@@ -2347,7 +2347,7 @@ public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)
## BaseGraph
class in XCharts.Runtime / Inherits from: [MaskableGraphic](https://docs.unity3d.com/ScriptReference/30_search.html?q=maskablegraphic),[IPointerDownHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointerdownhandler),[IPointerUpHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointeruphandler),[](#) / Subclasses: [BaseChart](#basechart),[UIComponent](#uicomponent)
class in XCharts.Runtime / Inherits from: [MaskableGraphic](https://docs.unity3d.com/ScriptReference/30_search.html?q=maskablegraphic),[IPointerDownHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointerdownhandler),[IPointerUpHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointeruphandler), / Subclasses: [BaseChart](#basechart),[UIComponent](#uicomponent)
### BaseGraph.chartHideFlags
@@ -5858,7 +5858,7 @@ class in / Subclasses: [XLog](#xlog)
## ObjectPool<T> where T
class in XCharts.Runtime / Inherits from: [new()](#new())
class in XCharts.Runtime / Inherits from: new()
### ObjectPool<T> where T.countActive
@@ -8612,7 +8612,7 @@ Whether to show ignored data on tooltip.
### Tooltip.itemFormatter
public string itemFormatter
a string template formatter for a single Serie or data item content. Support for wrapping lines with \n. Template variables are {.}, {a}, {b}, {c}, {d}.<br/> {.} is the dot of the corresponding color of a Serie that is currently indicated or whose index is 0.<br/> {a} is the series name of the serie that is currently indicated or whose index is 0.<br/> {b} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).<br/> {c} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.<br/> {d} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.<br/> {e} is the name of the data item serieData that is currently indicated or whose index is 0.<br/> {f} is sum of data.<br/> {y} is category value of y axis.<br/> {.1} represents a dot from serie corresponding color that specifies index as 1.<br/> 1 in {a1}, {b1}, {c1} represents a serie that specifies an index of 1.<br/> {c1:2} represents the third data from serie's current indication data item indexed to 1 (a data item has multiple data, index 2 represents the third data).<br/> {c1:2-2} represents the third data item from serie's third data item indexed to 1 (i.e., which data item must be specified to specify).<br/> {d1:2: F2} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).<br/> {d:0.##} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).<br/> Example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1} : {c1:1-1: f1}"<br/>
a string template formatter for a single Serie or data item content. Support for wrapping lines with \n. Template variables are \{.\}, \{a\}, \{b\}, \{c\}, \{d\}.<br/> \{.\} is the dot of the corresponding color of a Serie that is currently indicated or whose index is 0.<br/> \{a\} is the series name of the serie that is currently indicated or whose index is 0.<br/> \{b\} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).<br/> \{c\} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.<br/> \{d\} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.<br/> \{e\} is the name of the data item serieData that is currently indicated or whose index is 0.<br/> \{f\} is sum of data.<br/> \{y\} is category value of y axis.<br/> \{.1\} represents a dot from serie corresponding color that specifies index as 1.<br/> 1 in \{a1\}, \{b1\}, \{c1\} represents a serie that specifies an index of 1.<br/> \{c1:2\} represents the third data from serie's current indication data item indexed to 1 (a data item has multiple data, index 2 represents the third data).<br/> \{c1:2-2\} represents the third data item from serie's third data item indexed to 1 (i.e., which data item must be specified to specify).<br/> \{d1:2: F2\} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).<br/> \{d:0.##\} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).<br/> Example: "\{a\}, \{c\}", "\{a1\}, \{c1: f1\}", "\{a1\}, \{c1:0: f1\}", "\{a1\} : \{c1:1-1: f1\}"<br/>
### Tooltip.marker
@@ -8662,7 +8662,7 @@ Whether to show the tooltip floating layer, whose default value is true. It shou
### Tooltip.titleFormatter
public string titleFormatter
String template formatter for tooltip title content. \n line wrapping is supported. The placeholder {i} can be set separately to indicate that title is ignored and not displayed. Template variables are {.}, {a}, {b}, {c}, {d}, {e}, {f}, and {g}. <br /> {.} is the dot of the corresponding color of serie currently indicated or index 0. <br /> {a} is the series name name of serie currently indicated or index 0. <br /> {b} is the name of the serie data item serieData currently indicated or index 0, or the category value (such as the X-axis of a line chart). <br /> {c} is the value of the serie y-dimension (dimesion is 1) currently indicated or index is 0. <br /> {d} is the serie y-dimensional (dimesion 1) percentage value of the currently indicated or index 0, note without the % sign. <br /> {e} is the name of the serie data item serieData currently indicated or whose index is 0. <br /> {h} is the hexadecimal color value of serieData for the serie data item currently indicated or index 0. <br /> {f} is the sum of data. <br /> {g} indicates the total number of data. <br /> {y} is category value of y axis. <br /> {.1} represents a dot of the corresponding color with serie specified as index 1. <br /> The 1 in {a1}, {b1}, {c1} represents serie where index is specified as 1. <br /> {c1:2} represents the third data of the current indicator data item in serie with index 1 (one data item has multiple data, index 2 represents the third data). <br /> {c1:2-2} represents the third data of serie third data item with index 1 (that is, the number of data items must be specified when specifying the number of data items). <br /> {d1:2:f2} indicates that a format string with a single value is f2 (numericFormatter is used if no value is specified). <br /> {d:0.##} indicates that the format string with a value specified alone is 0.## # (for percentages, preserving a 2-digit significant number while avoiding the "100.00%" situation with f2). <br /> example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1}, {c1:1-1: f1}"
String template formatter for tooltip title content. \n line wrapping is supported. The placeholder \{i\} can be set separately to indicate that title is ignored and not displayed. Template variables are \{.\}, \{a\}, \{b\}, \{c\}, \{d\}, \{e\}, \{f\}, and \{g\}. <br /> \{.\} is the dot of the corresponding color of serie currently indicated or index 0. <br /> \{a\} is the series name name of serie currently indicated or index 0. <br /> \{b\} is the name of the serie data item serieData currently indicated or index 0, or the category value (such as the X-axis of a line chart). <br /> \{c\} is the value of the serie y-dimension (dimesion is 1) currently indicated or index is 0. <br /> \{d\} is the serie y-dimensional (dimesion 1) percentage value of the currently indicated or index 0, note without the % sign. <br /> \{e\} is the name of the serie data item serieData currently indicated or whose index is 0. <br /> \{h\} is the hexadecimal color value of serieData for the serie data item currently indicated or index 0. <br /> \{f\} is the sum of data. <br /> \{g\} indicates the total number of data. <br /> \{y\} is category value of y axis. <br /> \{.1\} represents a dot of the corresponding color with serie specified as index 1. <br /> The 1 in \{a1\}, \{b1\}, \{c1\} represents serie where index is specified as 1. <br /> \{c1:2\} represents the third data of the current indicator data item in serie with index 1 (one data item has multiple data, index 2 represents the third data). <br /> \{c1:2-2\} represents the third data of serie third data item with index 1 (that is, the number of data items must be specified when specifying the number of data items). <br /> \{d1:2:f2\} indicates that a format string with a single value is f2 (numericFormatter is used if no value is specified). <br /> \{d:0.##\} indicates that the format string with a value specified alone is 0.## # (for percentages, preserving a 2-digit significant number while avoiding the "100.00%" situation with f2). <br /> example: "\{a\}, \{c\}", "\{a1\}, \{c1: f1\}", "\{a1\}, \{c1:0: f1\}", "\{a1\}, \{c1:1-1: f1\}"
### Tooltip.AddSerieDataIndex
@@ -8722,11 +8722,6 @@ public void SetActive(bool flag)
public void SetContentActive(bool flag)
设置文本框是否显示
### Tooltip.UpdateContentPos
public void UpdateContentPos(Vector2 pos, float width, float height)
更新文本框位置
## Tooltip.Position
class in XCharts.Runtime
@@ -8804,7 +8799,7 @@ public static bool IsIgnoreFormatter(string itemFormatter)
### TooltipHelper.LimitInRect
public static void LimitInRect(Tooltip tooltip, Rect chartRect)
public static void LimitInRect(BaseChart chart, Tooltip tooltip, Rect chartRect)
## TooltipTheme
@@ -9001,6 +8996,10 @@ public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)
public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)
### UGLHelper.IsUp
public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3)
### UGLHelper.IsValueEqualsColor
public static bool IsValueEqualsColor(Color color1, Color color2)

View File

@@ -1,7 +1,12 @@
---
sidebar_position: 61
slug: /changelog
---
# 更新日志
# Changelog
[master](#master)
[v3.12.1](#v3121)
[v3.12.0](#v3120)
[v3.11.2](#v3112)
[v3.11.1](#v3111)
@@ -72,6 +77,28 @@
## master
## v3.12.1
Version Highlights:
* Enhanced Chinese and English support for the official website documentation.
* Optimized the rendering performance of line charts when data points are densely packed.
* Other issue fixes.
Log Details:
* (2024.12.01) Released `v3.12.1` version.
* (2024.11.30) Fixed an issue where the `Tooltip` displayed incorrectly on mobile devices when setting other anchors in charts.
* (2024.11.27) Resolved some code warning issues in `Unity6`.
* (2024.11.26) Fixed a problem where the `Tooltip` might exceed the screen and appear incomplete under specific circumstances.
* (2024.11.24) Fixed an issue where `UITable` would also select items during dragging.
* (2024.11.22) Fixed an abnormal effect issue when dynamically changing the `Time` timeline with `Animation` enabled.
* (2024.11.18) Optimized `Line` rendering for better performance when data points are densely packed.
* (2024.11.16) Fixed an issue where `Animation` could not be enabled through code (#334).
* (2024.11.13) Fixed a problem where dynamically modifying the `start` and `end` of `DataZoom` through code did not refresh the chart.
* (2024.11.05) Fixed an issue where the `Title` remained visible after being set to hidden.
* (2024.11.01) Improved `website` documentation in both English and Chinese.
## v3.12.0
Version Highlights:
@@ -153,7 +180,7 @@ Changelog Details:
## v3.10.2
* (2024.03.11) Release `v3.10.2`
* (2024.03.11) Fix to `Legend`'s `formatter` showing possible mismatches when setting {d} (#304)
* (2024.03.11) Fix to `Legend`'s `formatter` showing possible mismatches when setting `{d}` (#304)
* (2024.03.11) Fix to `Tooltip` still showing after moving out of coordinate system
* (2024.03.08) Fixed an issue where `Tooltip`'s title might not appear after upgrading from an older version
@@ -171,7 +198,7 @@ Highlights:
* Added chart border Settings to support rounded corner charts
* Fixed several issues
Extended features:
Extension features:
* Added `SankeyChart` Sankey chart
* Added `border` Settings for `UITable`
@@ -212,7 +239,7 @@ Highlights:
* Perfect code comments and documentation
* Fixed several issues
Extended features:
Extension features:
* `UITable` adds the carousel function
* `UITable` adds data api and callback functions
@@ -377,7 +404,7 @@ Log details:
Highlights:
* Updated documentation structure, added [Official XCharts Homepage](https://xcharts-team.github.io)
* Updated documentation structure, added [Official XCharts Homepage](https://xcharts-team.github.io/en)
* Added support for the DataZoom box selected.
* Added support for maximum width Settings for bars.
* Other optimizations.
@@ -629,7 +656,7 @@ Details:
* (2022.03.20) Release `v2.7.0` version
* (2022.02.21) Fixed chart name repeat check error #183
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
* (2022.02.08) Fixed {d} formatter error when value is 0
* (2022.02.08) Fixed `{d}` formatter error when value is 0
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
* (2022.01.06) Improved `Zebra` bar chart

View File

@@ -2,9 +2,7 @@
sidebar_position: 31
slug: /configuration
---
import APITable from '@site/src/components/APITable';
# Chart Configuration
# Configuration
## Serie
@@ -2464,7 +2462,7 @@ the distance of label to axis line.
`string`
label content string template formatter. \n line wrapping is supported. Formatters for some components will not take effect. <br /> Template placeholder have the following, some of which apply only to fixed components: <br /> `{.}` : indicates the dot mark. <br /> `{a}` : indicates the series name. <br /> `{b}` : category value of x axis or data name. <br /> `{c}` : data value. <br /> `{d}` : percentage. <br /> `{e}` : indicates the data name. <br /> `{f}` : data sum. <br /> `{g}` : indicates the total number of data. <br /> `{h}` : hexadecimal color value. <br /> `{y}` : category value of y axis. <br /> `{value}` : The value of the axis or legend. <br /> The following placeholder apply to `UITable` components: <br /> `{name}` : indicates the row name of the table. <br /> `{index}` : indicates the row number of the table. <br /> The following placeholder apply to `UIStatistc` components: <br /> `{title}` : title text. <br /> `{dd}` : day. <br /> `{hh}` : hours. <br /> `{mm}` : minutes. <br /> `{ss}` : second. <br /> `{fff}` : milliseconds. <br /> `{d}` : day. <br /> `{h}` : hours. <br /> `{m}` : minutes. <br /> `{s}` : second. <br /> `{f}` : milliseconds. <br /> Example :{b}:{c}<br />
label content string template formatter. \n line wrapping is supported. Formatters for some components will not take effect. <br /> Template placeholder have the following, some of which apply only to fixed components: <br /> `\{.\}` : indicates the dot mark. <br /> `\{a\}` : indicates the series name. <br /> `\{b\}` : category value of x axis or data name. <br /> `\{c\}` : data value. <br /> `\{d\}` : percentage. <br /> `\{e\}` : indicates the data name. <br /> `\{f\}` : data sum. <br /> `\{g\}` : indicates the total number of data. <br /> `\{h\}` : hexadecimal color value. <br /> `\{y\}` : category value of y axis. <br /> `\{value\}` : The value of the axis or legend. <br /> The following placeholder apply to `UITable` components: <br /> `\{name\}` : indicates the row name of the table. <br /> `\{index\}` : indicates the row number of the table. <br /> The following placeholder apply to `UIStatistc` components: <br /> `\{title\}` : title text. <br /> `\{dd\}` : day. <br /> `\{hh\}` : hours. <br /> `\{mm\}` : minutes. <br /> `\{ss\}` : second. <br /> `\{fff\}` : milliseconds. <br /> `\{d\}` : day. <br /> `\{h\}` : hours. <br /> `\{m\}` : minutes. <br /> `\{s\}` : second. <br /> `\{f\}` : milliseconds. <br /> Example :\{b\}:\{c\}<br />
### LabelStyle.height
@@ -4850,7 +4848,7 @@ Whether to show ignored data on tooltip.
`string`
a string template formatter for a single Serie or data item content. Support for wrapping lines with \n. Template variables are {.}, {a}, {b}, {c}, {d}.<br/> {.} is the dot of the corresponding color of a Serie that is currently indicated or whose index is 0.<br/> {a} is the series name of the serie that is currently indicated or whose index is 0.<br/> {b} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).<br/> {c} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.<br/> {d} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.<br/> {e} is the name of the data item serieData that is currently indicated or whose index is 0.<br/> {f} is sum of data.<br/> {y} is category value of y axis.<br/> {.1} represents a dot from serie corresponding color that specifies index as 1.<br/> 1 in {a1}, {b1}, {c1} represents a serie that specifies an index of 1.<br/> {c1:2} represents the third data from serie's current indication data item indexed to 1 (a data item has multiple data, index 2 represents the third data).<br/> {c1:2-2} represents the third data item from serie's third data item indexed to 1 (i.e., which data item must be specified to specify).<br/> {d1:2: F2} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).<br/> {d:0.##} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).<br/> Example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1} : {c1:1-1: f1}"<br/>
a string template formatter for a single Serie or data item content. Support for wrapping lines with \n. Template variables are \{.\}, \{a\}, \{b\}, \{c\}, \{d\}.<br/> \{.\} is the dot of the corresponding color of a Serie that is currently indicated or whose index is 0.<br/> \{a\} is the series name of the serie that is currently indicated or whose index is 0.<br/> \{b\} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).<br/> \{c\} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.<br/> \{d\} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.<br/> \{e\} is the name of the data item serieData that is currently indicated or whose index is 0.<br/> \{f\} is sum of data.<br/> \{y\} is category value of y axis.<br/> \{.1\} represents a dot from serie corresponding color that specifies index as 1.<br/> 1 in \{a1\}, \{b1\}, \{c1\} represents a serie that specifies an index of 1.<br/> \{c1:2\} represents the third data from serie's current indication data item indexed to 1 (a data item has multiple data, index 2 represents the third data).<br/> \{c1:2-2\} represents the third data item from serie's third data item indexed to 1 (i.e., which data item must be specified to specify).<br/> \{d1:2: F2\} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).<br/> \{d:0.##\} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).<br/> Example: "\{a\}, \{c\}", "\{a1\}, \{c1: f1\}", "\{a1\}, \{c1:0: f1\}", "\{a1\} : \{c1:1-1: f1\}"<br/>
### Tooltip.itemHeight
@@ -4935,7 +4933,7 @@ Whether to show the tooltip floating layer, whose default value is true. It shou
`string`
String template formatter for tooltip title content. \n line wrapping is supported. The placeholder {i} can be set separately to indicate that title is ignored and not displayed. Template variables are {.}, {a}, {b}, {c}, {d}, {e}, {f}, and {g}. <br /> {.} is the dot of the corresponding color of serie currently indicated or index 0. <br /> {a} is the series name name of serie currently indicated or index 0. <br /> {b} is the name of the serie data item serieData currently indicated or index 0, or the category value (such as the X-axis of a line chart). <br /> {c} is the value of the serie y-dimension (dimesion is 1) currently indicated or index is 0. <br /> {d} is the serie y-dimensional (dimesion 1) percentage value of the currently indicated or index 0, note without the % sign. <br /> {e} is the name of the serie data item serieData currently indicated or whose index is 0. <br /> {h} is the hexadecimal color value of serieData for the serie data item currently indicated or index 0. <br /> {f} is the sum of data. <br /> {g} indicates the total number of data. <br /> {y} is category value of y axis. <br /> {.1} represents a dot of the corresponding color with serie specified as index 1. <br /> The 1 in {a1}, {b1}, {c1} represents serie where index is specified as 1. <br /> {c1:2} represents the third data of the current indicator data item in serie with index 1 (one data item has multiple data, index 2 represents the third data). <br /> {c1:2-2} represents the third data of serie third data item with index 1 (that is, the number of data items must be specified when specifying the number of data items). <br /> {d1:2:f2} indicates that a format string with a single value is f2 (numericFormatter is used if no value is specified). <br /> {d:0.##} indicates that the format string with a value specified alone is 0.## # (for percentages, preserving a 2-digit significant number while avoiding the "100.00%" situation with f2). <br /> example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1}, {c1:1-1: f1}"
String template formatter for tooltip title content. \n line wrapping is supported. The placeholder \{i\} can be set separately to indicate that title is ignored and not displayed. Template variables are \{.\}, \{a\}, \{b\}, \{c\}, \{d\}, \{e\}, \{f\}, and \{g\}. <br /> \{.\} is the dot of the corresponding color of serie currently indicated or index 0. <br /> \{a\} is the series name name of serie currently indicated or index 0. <br /> \{b\} is the name of the serie data item serieData currently indicated or index 0, or the category value (such as the X-axis of a line chart). <br /> \{c\} is the value of the serie y-dimension (dimesion is 1) currently indicated or index is 0. <br /> \{d\} is the serie y-dimensional (dimesion 1) percentage value of the currently indicated or index 0, note without the % sign. <br /> \{e\} is the name of the serie data item serieData currently indicated or whose index is 0. <br /> \{h\} is the hexadecimal color value of serieData for the serie data item currently indicated or index 0. <br /> \{f\} is the sum of data. <br /> \{g\} indicates the total number of data. <br /> \{y\} is category value of y axis. <br /> \{.1\} represents a dot of the corresponding color with serie specified as index 1. <br /> The 1 in \{a1\}, \{b1\}, \{c1\} represents serie where index is specified as 1. <br /> \{c1:2\} represents the third data of the current indicator data item in serie with index 1 (one data item has multiple data, index 2 represents the third data). <br /> \{c1:2-2\} represents the third data of serie third data item with index 1 (that is, the number of data items must be specified when specifying the number of data items). <br /> \{d1:2:f2\} indicates that a format string with a single value is f2 (numericFormatter is used if no value is specified). <br /> \{d:0.##\} indicates that the format string with a value specified alone is 0.## # (for percentages, preserving a 2-digit significant number while avoiding the "100.00%" situation with f2). <br /> example: "\{a\}, \{c\}", "\{a1\}, \{c1: f1\}", "\{a1\}, \{c1:0: f1\}", "\{a1\}, \{c1:1-1: f1\}"
### Tooltip.titleHeight

View File

@@ -1,155 +1,127 @@
# XCharts FAQ
---
sidebar_position: 41
slug: /faq
---
[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)
# FAQ
## how-to-adjust-the-margin-between-the-axis-and-the-background
## FAQ 1: How to adjust the margin between the axis and the background?
`Grid` conponentwhich can adjust the left, right, up, down margins of chart.
## how-to-play-agian-the-fadein-animation
## FAQ 2: How to play agian the fadeIn animation?
call the `chart.AnimationReset()` API.
## how-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
## FAQ 3: How to customize the color of data item in line chart and pie chart?
`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
## FAQ 4: How to formatter the text of axis label, such as add a units text?
Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
## how-to-stack-the-bar-of-bar-chart
## FAQ 5: How to stack the bar of bar chart?
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
## FAQ 6: How to make the bar serie in the same bar but not stack?
Set the `barGap` of `Serie` to `-1``stack` to null.
## how-to-adjust-the-bar-width-and-gap-of-barchart
## FAQ 7: How to adjust the bar width and gap of barchart?
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
## FAQ 8: How to adjust the color of bar?
Adjust the `ItemStyle` of `Data` in `inspector`.
## can-i-adjust-the-anchor-of-chart
## FAQ 9: Can I adjust the anchor of chart?
Yes, you can set any one of 16 anchors but the value use default.
## can-display-more-than-1000-data
## FAQ 10: Can display more than 1000 data?
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
## FAQ 11: Can line chart drawing be dash, dot and dash-dot?
Yes. Adjust the `lineType` of `Serie`.
## how-to-limit-the-value-range-of-the-y-axis
## FAQ 12: How to limit the value range of the Y-axis?
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
## FAQ 13: How to customize the tick value range of value axis?
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
## FAQ 14: How to display text at the top of data items?
Adjust the `Label` of `Serie`.
## how-do-i-customize-icons-for-data-items
## FAQ 15: How do I customize icons for data items?
Set the `Icon` of `Data` in `Serie`.
## how-to-anti-aliasing-and-make-the-chart-smoother
## FAQ 16: How to anti-aliasing and make the chart smoother?
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
## FAQ 17: Why does mouse over chart Tooltip not show?
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
## FAQ 18: How not to display the bar line of Tooltip?
Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
## how-do-i-customize-the-display-of-tooltip
## FAQ 19: How do I customize the display of Tooltip?
See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
## how-do-i-get-the-y-axis-to-display-multiple-decimal-places
## FAQ 20: How do I get the Y-axis to display multiple decimal places?
Set the `numericFormatter` parameter of `AxisLabel`.
## how-do-i-dynamically-update-data-with-code
## FAQ 21: How do I dynamically update data with code?
See example: `Example01_UpdateData.cs`
## how-to-display-legend-why-are-legends-sometimes-not-displayed
## FAQ 22: How to display legend? Why are legends sometimes not 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
## FAQ 23: How to make chart as prefab?
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
## FAQ 24: How do I draw custom graphic in chart,such as line or dot?
Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
## how-to-achieve-similar-data-movement-effect-of-electro-cardiogram
## FAQ 25: How to achieve similar data movement effect of ELECTRO cardiogram?
See `Example_Dynamic.cs`.
## how-do-i-use-the-background-component-what-are-the-conditions
## FAQ 26: How do I use the background component? What are the conditions?
Setting `show` to `true` for the `background` component.
## mesh-cannot-have-more-than-65000-vertices
## FAQ 27: Mesh can not have more than 65000 vertices?
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)
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?](#FAQ-10-can-display-more-than-1000-data)
## why-are-the-parameters-set-in-serie-reset-after-they-run
## FAQ 28: Why are the parameters set in Serie reset after they run?
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
## FAQ 29: 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
## FAQ 30: How to deal with TMP errors 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:
@@ -158,11 +130,23 @@ XCharts does not enable TMP by default, so there are no references to TMP on asm
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
## FAQ 31: 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
## FAQ 32: 2.x What are the common problems when upgrading version 3.x?
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.
## FAQ 33: How to display a line chart without white space on both sides and start from the 0 coordinate?
Set the `boundaryGap` parameter of the X-axis.
## FAQ 34: How to set some Series not to display Tooltips?
Setting the `itemFormatter` of `itemStyle` in `serie` to `'-'` can ignore `tooltip`.
## FAQ 35: Sometimes an overlapping line appears in the area line chart when using semi-transparent colors
This is a bug in the drawing of the area line chart. You can use light opaque colors instead of semi-transparent colors.

View File

@@ -0,0 +1,9 @@
---
title: Support
sidebar_position: 51
slug: /support
---
# Support
For technical support and to purchase additional charts, you can subscribe to the `VIP` service. For details, please send an email to `monitor1394@gmail.com` for consultation.

View File

@@ -1,13 +1,16 @@
---
title: Tutorial: Getting Started with XCharts 3.0 in 5 Minutes
title: Getting Started
sidebar_position: 11
slug: /tutorial01
---
# Tutorial: Getting Started with XCharts 3.0 in 5 Minutes
# Getting Started with XCharts in 5 Minutes
:::warning
> Note: This tutorial is only applicable to the XCharts 3.x version. For the 2.x version, please refer to [Tutorial: Mastering XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/Tutorial%3A5-Minute-Start-to-XCharts.md)
Note: This tutorial is only applicable to the XCharts 3.x version. For the 2.x version, please refer to [Tutorial: Mastering XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/tutorial--get-start-with-xcharts-in-5-minute-EN.md)
:::
## Prerequisites for XCharts
@@ -55,7 +58,11 @@ The import method of XCharts-Daemon can refer to the previous import method of X
After importing XCharts and compiling, the XCharts menu will appear in the Unity editor's menu bar, and you can start using XCharts.
>Note: The XCharts menu in the Unity menu bar indicates that XCharts is available.
:::tip
Note: The XCharts menu in the Unity menu bar indicates that XCharts is available.
:::
### Adding a Simple Chart
@@ -86,7 +93,11 @@ In the `Inspector` view, find the `LineChart` panel, and click the `Add Serie` b
![op_addserie](img/tutorial01_addserie.png)
![linechart2](img/tutorial01_linechart2.png)
>Note: Series are added through the `Add Serie` button. Different types of Series can be added. [What kinds of Series does XCharts have?](https://xcharts-team.github.io/docs/configuration#serie-系列)
:::tip
Series are added through the `Add Serie` button. Different types of Series can be added. [What kinds of Series does XCharts have?](https://xcharts-team.github.io/en/docs/configuration#serie-系列)
:::
### Adding Other Main Components
@@ -94,7 +105,11 @@ By default, the chart does not have a `Legend`. If you need a `Legend` component
![op_addcomponent](img/tutorial01_addcomponent.png)
>Note: Main components are added through the `Add Component` button. [What main components does XCharts have?](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
:::tip
Main components are added through the `Add Component` button. [What main components does XCharts have?](https://xcharts-team.github.io/en/docs/configuration/#maincomponent-主组件)
:::
### Adding Serie Components
@@ -103,7 +118,11 @@ Serie only comes with a few common components, and other components need to be a
![op_addseriecomponent](img/tutorial01_addseriecomponent.png)
![linechart3](img/tutorial01_linechart3.png)
>Note: Serie components are added through the button on the right side of Serie. [What components can be added to Serie in XCharts?](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::tip
Serie components are added through the button on the right side of Serie. [What components can be added to Serie in XCharts?](https://xcharts-team.github.io/en/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::
### Adding SerieData Components
@@ -112,7 +131,11 @@ If you need to customize the configuration of each data item individually, you c
![op_addseriedatacomponent](img/tutorial01_addseriedatacomponent.png)
![linechart4](img/tutorial01_linechart4.png)
>Note: SerieData components are added through the button on the right side of SerieData after expanding. [What components can be added to SerieData in XCharts?](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
:::tip
SerieData components are added through the button on the right side of SerieData after expanding. [What components can be added to SerieData in XCharts?](https://xcharts-team.github.io/en/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
:::
### More Components and Configuration Parameters
@@ -133,7 +156,11 @@ To quickly locate the component corresponding to the effect you want to change,
2. If the `ItemStyle` of `Serie` has a color value other than `0000`, this color value is used.
3. Otherwise, the color value is taken from the `Color Palette` of the theme `Theme`.
>Note: The color value is usually `0000` when using the default color of the theme; other parameters are `0` or null when using the default configuration of the theme; pay attention to transparency when setting colors.
:::tip
The color value is usually `0000` when using the default color of the theme; other parameters are `0` or null when using the default configuration of the theme; pay attention to transparency when setting colors.
:::
### Adding a Line Chart with Code
@@ -214,7 +241,11 @@ Now, a simple line chart is ready:
If there are multiple series in a Chart, the data of Axis only needs to be added once, and should not be repeated in multiple loops.
>Remember: The number of Axis data should be consistent with the number of Serie data.
:::tip
Remember: The number of Axis data should be consistent with the number of Serie data.
:::
For the complete code, please refer to `Examples`: `Example13_LineSimple.cs`
@@ -229,7 +260,11 @@ The default font used by XCharts is Unity's default font `Arial`, which may not
After the font is set, newly created charts will use the newly set font. For old charts, you can click the `Rebuild Chart Object` button to refresh.
>Note: It is recommended to set the font before using XCharts; when updating XCharts, pay attention to the potential restoration of the set font.
:::tip
It is recommended to set the font before using XCharts; when updating XCharts, pay attention to the potential restoration of the set font.
:::
### Using TextMeshPro
@@ -271,7 +306,11 @@ XCharts has an automatic refresh mechanism, but it is also triggered under certa
2. `chart.RefreshChart()`: Refresh chart rendering, which only refreshes the rendering part and will not refresh component text, position, etc.
3. Each component can also refresh itself by calling `SetAllDirty()`.
>Note: Use APIs to manipulate data and various lists, not directly access the list for processing.
:::tip
Use APIs to manipulate data and various lists, not directly access the list for processing.
:::
### Changing Parameters on Main Components
@@ -288,7 +327,11 @@ xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
```
> Note: In older versions without the `EnsureChartComponent()` interface, use `GetOrAddChartComponent()`
:::tip
In older versions without the `EnsureChartComponent()` interface, use `GetOrAddChartComponent()`
:::
### Changing Serie Parameters

View File

@@ -2347,7 +2347,7 @@ public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)
## BaseGraph
class in XCharts.Runtime / 继承自: [MaskableGraphic](https://docs.unity3d.com/ScriptReference/30_search.html?q=maskablegraphic),[IPointerDownHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointerdownhandler),[IPointerUpHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointeruphandler),[](#) / 子类: [BaseChart](#basechart),[UIComponent](#uicomponent)
class in XCharts.Runtime / 继承自: [MaskableGraphic](https://docs.unity3d.com/ScriptReference/30_search.html?q=maskablegraphic),[IPointerDownHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointerdownhandler),[IPointerUpHandler](https://docs.unity3d.com/ScriptReference/30_search.html?q=ipointeruphandler), / 子类: [BaseChart](#basechart),[UIComponent](#uicomponent)
### BaseGraph.chartHideFlags
@@ -5858,7 +5858,7 @@ class in / 子类: [XLog](#xlog)
## ObjectPool&lt;T&gt; where T
class in XCharts.Runtime / 继承自: [new()](#new())
class in XCharts.Runtime / 继承自: new()
### ObjectPool&lt;T&gt; where T.countActive
@@ -8612,7 +8612,7 @@ public bool ignoreDataShow
### Tooltip.itemFormatter
public string itemFormatter
提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {i}或-表示忽略当前项。 {.}为当前所指示的serie或数据项的对应颜色的圆点。<br/> {a}为当前所指示的serie或数据项的系列名name。<br/> {b}为当前所指示的serie或数据项的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示的serie或数据项的y维dimesion为1的数值。<br/> {d}为当前所指示的serie或数据项的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示的serie或数据项的数据项serieData的name。<br/> {f}为当前所指示的serie的默认维度的数据总和。<br/> {g}为当前所指示的serie的数据总个数。<br/> {h}为当前所指示的serie的十六进制颜色值。<br/> {y}为当前所指示的serie的y轴的类目值。<br/> {c0}表示当前数据项维度为0的数据。<br/> {c1}表示当前数据项维度为1的数据。<br/> {d3}表示维度3的数据的百分比。它的分母是默认维度一般是1维度数据。<br/> |表示多个列的分隔。<br/> 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}", "{.}|{b}|{y}"
提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有\{.\}、\{a\}、\{b\}、\{c\}、\{d\}、\{e\}、\{f\}、\{g\}。<br/> \{i\}或-表示忽略当前项。 \{.\}为当前所指示的serie或数据项的对应颜色的圆点。<br/> \{a\}为当前所指示的serie或数据项的系列名name。<br/> \{b\}为当前所指示的serie或数据项的数据项serieData的name或者类目值如折线图的X轴。<br/> \{c\}为当前所指示的serie或数据项的y维dimesion为1的数值。<br/> \{d\}为当前所指示的serie或数据项的y维dimesion为1百分比值注意不带%号。<br/> \{e\}为当前所指示的serie或数据项的数据项serieData的name。<br/> \{f\}为当前所指示的serie的默认维度的数据总和。<br/> \{g\}为当前所指示的serie的数据总个数。<br/> \{h\}为当前所指示的serie的十六进制颜色值。<br/> \{y\}为当前所指示的serie的y轴的类目值。<br/> \{c0\}表示当前数据项维度为0的数据。<br/> \{c1\}表示当前数据项维度为1的数据。<br/> \{d3\}表示维度3的数据的百分比。它的分母是默认维度一般是1维度数据。<br/> |表示多个列的分隔。<br/> 示例:"\{i\}", "\{.\}|\{a\}|\{c\}", "\{.\}|\{b\}|\{c2:f2\}", "\{.\}|\{b\}|\{y\}"
### Tooltip.marker
@@ -8662,7 +8662,7 @@ public bool showContent
### Tooltip.titleFormatter
public string titleFormatter
提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> {d}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {y}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符\{i\}表示忽略不显示title。 模板变量有\{.\}、\{a\}、\{b\}、\{c\}、\{d\}、\{e\}、\{f\}、\{g\}。<br/> \{.\}为当前所指示或index为0的serie的对应颜色的圆点。<br/> \{a\}为当前所指示或index为0的serie的系列名name。<br/> \{b\}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> \{c\}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> \{d\}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> \{e\}为当前所指示或index为0的serie的数据项serieData的name。<br/> \{h\}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> \{f\}为数据总和。<br/> \{g\}为数据总个数。<br/> \{y\}为value所对应的y轴的类目值。<br/> \{.1\}表示指定index为1的serie对应颜色的圆点。<br/> \{a1\}、\{b1\}、\{c1\}中的1表示指定index为1的serie。<br/> \{c1:2\}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> \{c1:2-2\}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> \{d1:2:f2\}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> \{d:0.##\} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"\{a\}:\{c\}"、"\{a1\}:\{c1:f1\}"、"\{a1\}:\{c1:0:f1\}"、"\{a1\}:\{c1:1-1:f1\}"
### Tooltip.AddSerieDataIndex
@@ -8722,11 +8722,6 @@ public void SetActive(bool flag)
public void SetContentActive(bool flag)
设置文本框是否显示
### Tooltip.UpdateContentPos
public void UpdateContentPos(Vector2 pos, float width, float height)
更新文本框位置
## Tooltip.Position
class in XCharts.Runtime
@@ -8804,7 +8799,7 @@ public static bool IsIgnoreFormatter(string itemFormatter)
### TooltipHelper.LimitInRect
public static void LimitInRect(Tooltip tooltip, Rect chartRect)
public static void LimitInRect(BaseChart chart, Tooltip tooltip, Rect chartRect)
## TooltipTheme
@@ -9001,6 +8996,10 @@ public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)
public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)
### UGLHelper.IsUp
public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3)
### UGLHelper.IsValueEqualsColor
public static bool IsValueEqualsColor(Color color1, Color color2)

View File

@@ -6,6 +6,7 @@ slug: /changelog
# 更新日志
[master](#master)
[v3.12.1](#v3121)
[v3.12.0](#v3120)
[v3.11.2](#v3112)
[v3.11.1](#v3111)
@@ -77,6 +78,28 @@ slug: /changelog
## master
## v3.12.1
版本要点:
* 完善官网文档的中英文支持
* 优化折线图数据密集时的绘制效果
* 其他问题修复
日志详情:
* (2024.12.01) 发布`v3.12.1`版本
* (2024.11.30) 修复`Tooltip`在图表设置其他锚点时手机上显示位置异常的问题
* (2024.11.27) 修复`Unity6`的一些代码警告问题
* (2024.11.26) 修复`Tooltip`在特殊情况下可能会超出屏幕显示不完整的问题
* (2024.11.24) 修复`UITable`在拖拽时也会点选的问题
* (2024.11.22) 修复`Time`时间轴在开启`Animation`时动态变更效果异常的问题
* (2024.11.18) 优化`Line`在数据点过密时有更好的绘制效果
* (2024.11.16) 修复`Animation`无法通过代码开启的问题 (#334)
* (2024.11.13) 修复`DataZoom`的start和end在代码动态修改时图表不刷新的问题
* (2024.11.05) 修复`Title`设置隐藏后运行还显示的问题
* (2024.11.01) 完善`website`中英文文档
## v3.12.0
版本要点:
@@ -130,6 +153,8 @@ slug: /changelog
日志详情:
* (2024.06.16) 发布`v3.11.0`版本
* (2024.06.15) 增加`Editor``Data`的添加、删除、上下移动操作按钮
* (2024.06.11) 修复`Axis``IndicatorLabel`可能会遮挡住`Tooltip`的问题
@@ -189,12 +214,19 @@ slug: /changelog
* (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名
* (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴
* (2024.01.18) 修复`Animation``type`代码动态修改无效的问题
* (2024.01.16) 增加`UIImage`图片组件
* (2024.01.16) 优化`Background`组件,可设置圆角和边框
* (2024.01.13) 增加`Chart`的更多快捷创建图表菜单
* (2024.01.09) 增加`Background``borderStyle`,给图表默认设置圆角
* (2024.01.07) 修复`Tooltop`的第一个`ContentLabelStyle`设置`color`无效的问题
* (2024.01.03) 增加`UITable``carouselStyle``hoverPause`
* (2024.01.02) 增加`UITable``scrollStyle``borderStyle`
* (2024.01.02) 增加`UITable``columnHeadStyle``opaque`
* (2024.01.01) 调整`UITable``border`边框相关设置,用`BorderStyle`代替
* (2024.01.01) 增加`BorderStyle`边框样式
* (2023.12.26) 增加`Heatmap``maxCache`参数支持
* (2023.12.25) 优化`Line`开启`clip`时绘制的顶点数
* (2023.12.22) 增加`UITable`的行边框
* (2023.12.22) 修复`Scatter`散点图部分边界数据不显示的问题
* (2023.12.21) 修复`TriggerTooltip()`接口在指定0或最大index时可能无法触发的问题
* (2023.12.19) 修复`Legend``LabelStyle`设置`formatter`后不生效的问题
@@ -233,15 +265,27 @@ slug: /changelog
* (2023.11.23) 增加`Axis``Animation`支持动画效果
* (2023.11.16) 取消`Legend``formatter`,用`LabelStyle`的代替
* (2023.11.14) 完善`LabelStyle``formatter`的注释和文档(#291)
* (2023.11.14) 增加`UITable``GetData()``GetContent()`接口
* (2023.11.12) 增加`UITable``onTableClick`点击表格回调
* (2023.11.11) 重构`UITable``SeparatorStyle`,可分开设置行列的分割线
* (2023.11.11) 修复`Documentation`部分注释生成文档不完整的问题 (#290)
* (2023.11.11) 修复`Legend``formatter`在数据变更时没有自动刷新的问题
* (2023.11.05) 增加`UITable``ColumnStyle`重构Column相关参数
* (2023.11.05) 增加`UITable``RowStyle`重构Row相关参数
* (2023.11.05) 修复`SerieEventData``value`一直是0的问题 (#287)
* (2023.11.03) 修复`Bar`设置渐变色时鼠标移出效果异常的问题 (#285)
* (2023.11.02) 优化`SerieData`设置`ignore``formatter`的忽略问题
* (2023.11.01) 增加`UITable``CarouselStyle`轮播功能
* (2023.11.01) 增加`UITable``AddColumn()``UpdateColumn()`接口
* (2023.11.01) 增加`MarkLine``onTop`设置是否显示在最上层
* (2023.10.23) 修复`UITable`点击`Rebuild Object`异常的问题
* (2023.10.23) 修复`UITable`尺寸变化时不刷新的问题
* (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题
* (2023.10.21) 增加`Axis`的对数轴支持子刻度
* (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题
* (2023.10.17) 修复`UITable`首次初始化异常的问题
* (2023.10.17) 增加`UITable`的数据操作接口
* (2023.10.17) 增加`UITable``RefreshTable()`刷新接口
* (2023.10.15) 修复`Line`设置`Animation``AlongPath`时动画异常的问题 (#281)
* (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题
* (2023.10.11) 修复`Serie``showDataDimension`设置无效的问题

View File

@@ -2,8 +2,6 @@
sidebar_position: 31
slug: /configuration
---
import APITable from '@site/src/components/APITable';
# 配置项手册
## Serie 系列
@@ -2464,7 +2462,7 @@ class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent), [ISerie
`string`
标签内容字符串模版格式器。支持用 \n 换行。部分组件的格式器会不生效。<br/> 模板通配符有以下这些,部分只适用于固定的组件:<br/> `{.}`:圆点标记。<br/> `{a}`:系列名。<br/> `{b}`X轴类目名或数据名。<br/> `{c}`:数据值。<br/> `{d}`:百分比。<br/> `{e}`:数据名。<br/> `{f}`:数据和。<br/> `{g}`:数据总个数。<br/> `{h}`:十六进制颜色值。<br/> `{y}`Y轴的类目名。<br/> `{value}`:坐标轴或图例的值。<br/> 以下通配符适用UITable组件<br/> `{name}` 表格的行名。<br/> `{index}`:表格的行号。<br/> 以下通配符适用UIStatistc组件<br/> `{title}`:标题文本。<br/> `{dd}`:天。<br/> `{hh}`:小时。<br/> `{mm}`:分钟。<br/> `{ss}`:秒。<br/> `{fff}`:毫秒。<br/> `{d}`:天。<br/> `{h}`:小时。<br/> `{m}`:分钟。<br/> `{s}`:秒。<br/> `{f}`:毫秒。<br/> 示例:“{b}:{c}”
标签内容字符串模版格式器。支持用 \n 换行。部分组件的格式器会不生效。<br/> 模板通配符有以下这些,部分只适用于固定的组件:<br/> `\{.\}`:圆点标记。<br/> `\{a\}`:系列名。<br/> `\{b\}`X轴类目名或数据名。<br/> `\{c\}`:数据值。<br/> `\{d\}`:百分比。<br/> `\{e\}`:数据名。<br/> `\{f\}`:数据和。<br/> `\{g\}`:数据总个数。<br/> `\{h\}`:十六进制颜色值。<br/> `\{y\}`Y轴的类目名。<br/> `\{value\}`:坐标轴或图例的值。<br/> 以下通配符适用UITable组件<br/> `\{name\}` 表格的行名。<br/> `\{index\}`:表格的行号。<br/> 以下通配符适用UIStatistc组件<br/> `\{title\}`:标题文本。<br/> `\{dd\}`:天。<br/> `\{hh\}`:小时。<br/> `\{mm\}`:分钟。<br/> `\{ss\}`:秒。<br/> `\{fff\}`:毫秒。<br/> `\{d\}`:天。<br/> `\{h\}`:小时。<br/> `\{m\}`:分钟。<br/> `\{s\}`:秒。<br/> `\{f\}`:毫秒。<br/> 示例:“\{b\}:\{c\}”
### LabelStyle.height
@@ -3090,7 +3088,7 @@ class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
`string`
标线名称将会作为文字显示。label的formatter可通过{b}显示名称,通过{c}显示数值。
标线名称将会作为文字显示。label的formatter可通过\{b\}显示名称,通过\{c\}显示数值。
### MarkLineData.startSymbol
@@ -4850,7 +4848,7 @@ class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
`string`
提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {i}或-表示忽略当前项。 {.}为当前所指示的serie或数据项的对应颜色的圆点。<br/> {a}为当前所指示的serie或数据项的系列名name。<br/> {b}为当前所指示的serie或数据项的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示的serie或数据项的y维dimesion为1的数值。<br/> {d}为当前所指示的serie或数据项的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示的serie或数据项的数据项serieData的name。<br/> {f}为当前所指示的serie的默认维度的数据总和。<br/> {g}为当前所指示的serie的数据总个数。<br/> {h}为当前所指示的serie的十六进制颜色值。<br/> {y}为当前所指示的serie的y轴的类目值。<br/> {c0}表示当前数据项维度为0的数据。<br/> {c1}表示当前数据项维度为1的数据。<br/> {d3}表示维度3的数据的百分比。它的分母是默认维度一般是1维度数据。<br/> |表示多个列的分隔。<br/> 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}", "{.}|{b}|{y}"
提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有\{.\}、\{a\}、\{b\}、\{c\}、\{d\}、\{e\}、\{f\}、\{g\}。<br/> \{i\}或-表示忽略当前项。 \{.\}为当前所指示的serie或数据项的对应颜色的圆点。<br/> \{a\}为当前所指示的serie或数据项的系列名name。<br/> \{b\}为当前所指示的serie或数据项的数据项serieData的name或者类目值如折线图的X轴。<br/> \{c\}为当前所指示的serie或数据项的y维dimesion为1的数值。<br/> \{d\}为当前所指示的serie或数据项的y维dimesion为1百分比值注意不带%号。<br/> \{e\}为当前所指示的serie或数据项的数据项serieData的name。<br/> \{f\}为当前所指示的serie的默认维度的数据总和。<br/> \{g\}为当前所指示的serie的数据总个数。<br/> \{h\}为当前所指示的serie的十六进制颜色值。<br/> \{y\}为当前所指示的serie的y轴的类目值。<br/> \{c0\}表示当前数据项维度为0的数据。<br/> \{c1\}表示当前数据项维度为1的数据。<br/> \{d3\}表示维度3的数据的百分比。它的分母是默认维度一般是1维度数据。<br/> |表示多个列的分隔。<br/> 示例:"\{i\}", "\{.\}|\{a\}|\{c\}", "\{.\}|\{b\}|\{c2:f2\}", "\{.\}|\{b\}|\{y\}"
### Tooltip.itemHeight
@@ -4935,7 +4933,7 @@ serie的符号标志。
`string`
提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> {d}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {y}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符\{i\}表示忽略不显示title。 模板变量有\{.\}、\{a\}、\{b\}、\{c\}、\{d\}、\{e\}、\{f\}、\{g\}。<br/> \{.\}为当前所指示或index为0的serie的对应颜色的圆点。<br/> \{a\}为当前所指示或index为0的serie的系列名name。<br/> \{b\}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> \{c\}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> \{d\}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> \{e\}为当前所指示或index为0的serie的数据项serieData的name。<br/> \{h\}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> \{f\}为数据总和。<br/> \{g\}为数据总个数。<br/> \{y\}为value所对应的y轴的类目值。<br/> \{.1\}表示指定index为1的serie对应颜色的圆点。<br/> \{a1\}、\{b1\}、\{c1\}中的1表示指定index为1的serie。<br/> \{c1:2\}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> \{c1:2-2\}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> \{d1:2:f2\}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> \{d:0.##\} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"\{a\}:\{c\}"、"\{a1\}:\{c1:f1\}"、"\{a1\}:\{c1:0:f1\}"、"\{a1\}:\{c1:1-1:f1\}"
### Tooltip.titleHeight

View File

@@ -5,183 +5,147 @@ slug: /faq
# 常见问题
[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 27Mesh 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 322.x版本升级3.x版本时常见的问题有哪些](#xcharts2升级xcharts3时常见的问题有哪些)
[FAQ 33折线图如何两边不留空白而从0坐标开始显示](#折线图如何两边不留空白而从0坐标开始显示)
[FAQ 34如何设置部分Serie不显示Tooltip](#如何设置部分serie不显示tooltip)
## 如何调整坐标轴与背景的边距
## FAQ 1如何调整坐标轴与背景的边距
调整`Grid`组件,可调整上下左右边距。
## 如何让初始动画重新播放
## FAQ 2如何让初始动画重新播放
调用`chart.AnimationReset()`接口。
## 如何自定义折线图饼图的颜色
## FAQ 3如何自定义折线图饼图的颜色
通过`Theme``colorPalette`调整,或者部分`Serie`下的`LineStyle``ItemStyle`
## 如何给坐标轴上的文本加上单位
## FAQ 4如何给坐标轴上的文本加上单位
通过`formatter``numericFormatter`参数,在`Legend``Axis``AxisLabel``Tooltop``Serie``Label`都提供该参数的配置。
## 如何让柱形图的柱子堆叠显示
## FAQ 5如何让柱形图的柱子堆叠显示
设置`Serie`下的`stack``stack`相同的`serie`会堆叠显示在一个柱子上。
## 如何让柱形图的柱子同柱但不重叠
## FAQ 6如何让柱形图的柱子同柱但不重叠
设置`Serie`下的`barGap``-1``stack`为空。
## 如何调整柱形图的柱子宽度和间距
## FAQ 7如何调整柱形图的柱子宽度和间距
调整`Serie`下的`barWidth``barGap`,多个`serie`时最后一个`serie``barWidth``barGap`有效。
## 如何调整柱形图单个柱子的颜色
## FAQ 8如何调整柱形图单个柱子的颜色
可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
## 如何调整图表的对齐方式
## FAQ 9如何调整图表的对齐方式
调整RectTransform的锚点和UGUI的其他组件的用法一致。
## 可以显示超过1000以上的大数据吗
## FAQ 10可以显示超过1000以上的大数据吗
可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie``symbol``label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large``largeThreshold`参数来开启性能模式。
## 折线图可以画虚线点线点划线吗
## FAQ 11折线图可以画虚线点线点划线吗
可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
## 如何限定y轴的值范围
## FAQ 12如何限定Y轴的值范围
设置`Axis`下的`minMaxType``Custom`,自定义`min``max`
## 如何自定义数值轴刻度大小
## FAQ 13如何自定义数值轴刻度大小
默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
## 如何在数据项顶上显示文本
## FAQ 14如何在数据项顶上显示文本
通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
## 如何给数据项自定义图标
## FAQ 15如何给数据项自定义图标
通过设置`Serie``data`下的数据项可单独设置`icon`相关参数。
## 锯齿太严重如何让图表更顺滑
## FAQ 16锯齿太严重如何让图表更顺滑
开启抗锯齿设置(在`Unity`里设置。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
## 为什么鼠标移上图表tooltip不显示
## FAQ 17为什么鼠标移上图表Tooltip不显示
确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
## 如何取消tooltip的竖线
## FAQ 18如何取消Tooltip的竖线
设置`Tooltip``type``None`。或者调整`lineStyle`的参数。
## 如何自定义tooltip的显示内容
## FAQ 19如何自定义Tooltip的显示内容
自定义总的内容可以通过`Tooltip``formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter``titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie``itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
## 如何让y轴显示多位小数
## FAQ 20如何让y轴显示多位小数
设置`Axis`下的`AxisLabel`中的`formatter``{value:f1}``{value:f2}``1.5.0`及以上版本通过`numericFormatter`设置。
## 如何用代码动态更新数据
## FAQ 21如何用代码动态更新数据
请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能相关API请查看文档[XChartsAPI接口](api.md) 。
## 如何显示图例为什么有时候图例无法显示
## FAQ 22如何显示图例为什么有时候图例无法显示
首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
## 如何做成预设
## FAQ 23如何做成预设
做成prefab前执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
## 如何在图表上画点画线等自定义内容
## FAQ 24如何在图表上画点画线等自定义内容
`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
## 如何实现心电图类似的数据移动效果
## FAQ 25如何实现心电图类似的数据移动效果
参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis``serie`都设置相同的`maxCache``maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
## 如何使用背景组件有什么条件限制
## FAQ 26如何使用背景组件有什么条件限制
设置`background`组件的`show``true`
## 区域折线图在用半透明颜色时有时候会一条叠加的线
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
## mesh_cannot_have_more_than_65000_vertices
## FAQ 27Mesh can not have more than 65000 vertices
这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[FAQ 10可以显示超过1000以上的大数据吗](#可以显示超过1000以上的大数据吗)
## 为什么serie里设置的参数运行后又被重置了
## FAQ 28为什么serie里设置的参数运行后又被重置了
检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
## 如何修改serie的symbol的颜色
## FAQ 29如何修改serie的symbol的颜色
`Symbol` 的颜色是使用的 `ItemStyle``color`
## 导入或更新xcharts时tmp报错怎么办
## FAQ 30导入或更新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`
`3.8.0`版本后增加[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)守护程序将XCharts-Daemon导入项目后在更新XCharts时守护程序会自动根据本地开启的TMP情况刷新asmdef确保编译正常。
## 支持空数据吗如何实现折线图断开的效果
## FAQ 31支持空数据吗如何实现折线图断开的效果
`Serie``data``double`类型,所以无法表示空数据。可通过开启`Serie``ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
## xcharts2升级xcharts3时常见的问题有哪些
## FAQ 322.x版本升级3.x版本时常见的问题有哪些
1. 'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!
3.x版本时不需要挂载XChartsMgr直接删掉场景上的`_xcharts_`节点即可。
1. 出现:`'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!`的问题时是因为3.x版本时不需要挂载XChartsMgr直接删掉场景上的`_xcharts_`节点即可。
## 折线图如何两边不留空白而从0坐标开始显示
## FAQ 33折线图如何两边不留空白而从0坐标开始显示
设置X轴的`boundaryGap`参数。
## 如何设置部分serie不显示tooltip
## FAQ 34如何设置部分Serie不显示Tooltip
`serie``itemStyle``itemFormatter`设置为`-`可以忽略`tooltip`
`serie``itemStyle``itemFormatter`设置为`-`可以忽略`serie``tooltip`
## FAQ 35区域折线图在用半透明颜色时有时候会一条叠加的线
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。

View File

@@ -6,7 +6,11 @@ slug: /tutorial01
# 教程5分钟上手 XCharts 3.0
> Note本教程仅适用XCharts 3.x版本2.x版本请看 [教程5分钟上手XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
:::warning
Note本教程仅适用XCharts 3.x版本2.x版本请看 [教程5分钟上手XCharts 2.0](https://github.com/XCharts-Team/XCharts/blob/2.0/Doc/教程5分钟上手XCharts.md)
:::
## XCharts的前提条件
@@ -22,7 +26,7 @@ XCharts是一个Unity图表插件目前只能在Unity平台使用。
## XCharts的获取和导入
XCharts主要通过Github来维护更新和发布可以到【Github主页】(https://github.com/XCharts-Team)进行下载获取源码和Pacakge对于无Github访问条件的用户可以访问[【国内镜像】](https://gitee.com/monitor1394/unity-ugui-XCharts)进行下载。国内镜像的版本更新可能会相对滞后。
XCharts主要通过Github来维护更新和发布可以到[【Github主页】](https://github.com/XCharts-Team)进行下载获取源码和Pacakge对于无Github访问条件的用户可以访问[【国内镜像】](https://gitee.com/monitor1394/unity-ugui-XCharts)进行下载。国内镜像的版本更新可能会相对滞后。
XCharts可通过以下任意一种方式导入到你的项目
@@ -54,7 +58,11 @@ XCharts-Daemon的导入方式可参考刚才的XCharts导入方式。可以通
导入XCharts并编译通过后Unity编辑器的菜单栏会显示XCharts这时可以开始使用XCharts了。
>NoteUnity的菜单栏出现XCharts菜单时才表示XCharts可用。
:::tip
Unity的菜单栏出现XCharts菜单时才表示XCharts可用。
:::
### 添加一个简单图表
@@ -85,7 +93,11 @@ Serie支持多维数据一般折线图只用到二维数据第一维表示
![op_addserie](img/tutorial01_addserie.png)
![linechart2](img/tutorial01_linechart2.png)
>NoteSerie通过`Add Serie`按钮添加。可添加不同类型的Serie。[XCharts有哪些Serie](https://xcharts-team.github.io/docs/configuration#serie-系列)
:::tip
Serie通过`Add Serie`按钮添加。可添加不同类型的Serie。[XCharts有哪些Serie](https://xcharts-team.github.io/docs/configuration#serie-系列)
:::
### 添加其他主组件
@@ -93,7 +105,11 @@ Serie支持多维数据一般折线图只用到二维数据第一维表示
![op_addcomponent](img/tutorial01_addcomponent.png)
>Note主组件通过`Add Component`按钮添加。[XCharts有哪些主组件](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
:::tip
主组件通过`Add Component`按钮添加。[XCharts有哪些主组件](https://xcharts-team.github.io/docs/configuration/#maincomponent-主组件)
:::
### 添加Serie组件
@@ -102,7 +118,11 @@ Serie只自带了几个常见的组件其他组件用到时需额外添加。
![op_addseriecomponent](img/tutorial01_addseriecomponent.png)
![linechart3](img/tutorial01_linechart3.png)
>NoteSerie组件通过Serie右边的按钮添加。[XCharts有哪些Serie组件](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::tip
Serie组件通过Serie右边的按钮添加。[XCharts有哪些Serie组件](https://xcharts-team.github.io/docs/configuration/#iseriecomponent-可添加到serie的组件)
:::
### 添加SerieData组件
@@ -111,7 +131,11 @@ Serie只自带了几个常见的组件其他组件用到时需额外添加。
![op_addseriedatacomponent](img/tutorial01_addseriedatacomponent.png)
![linechart4](img/tutorial01_linechart4.png)
>NoteSerieData组件通过展开SerieData后Component右边的按钮添加。[XCharts有哪些SerieData组件](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
:::tip
SerieData组件通过展开SerieData后Component右边的按钮添加。[XCharts有哪些SerieData组件](https://xcharts-team.github.io/docs/configuration/#iseriedatacomponent-可添加到seriedata的组件)
:::
### 更多组件和配置参数
@@ -131,7 +155,11 @@ XCharts是数据和参数驱动的。想要什么效果只需要去调整对
2. 如果`Serie``ItemStyle`配置有非`0000`颜色值,则优先用这个颜色值。
3. 否则颜色值取自主题`Theme``Color Palette`
>Note通常颜色值为0000时表示用主题默认颜色其他参数为0或null时表示用主题默认配置设置颜色时注意透明度。
:::tip
通常颜色值为0000时表示用主题默认颜色其他参数为0或null时表示用主题默认配置设置颜色时注意透明度。
:::
### 用代码添加折线图
@@ -212,7 +240,11 @@ for (int i = 0; i < 10; i++)
如果一个Chart里面有多个系列时则Axis的data只需要加一次不要多个循环加重复了。
>记住Axis的数据个数要和Serie的数据个数一致。
:::danger
请确保Axis的数据个数和Serie的数据个数一致。
:::
完整代码请查阅`Examples``Example13_LineSimple.cs`
@@ -227,7 +259,11 @@ XCharts默认使用的是Unity默认字体`Arial`在WebGL平台上可能无
字体设置好后,新创建的图表就会用新设置的字体了。对于旧图表,可以点击`Rebuild Chart Object`进行刷新。
>Note使用XCharts前建议先设置好字体更新XCharts时注意设置的字体可能被还原的问题。
:::warning
使用XCharts前建议先设置好字体更新XCharts时注意设置的字体可能被还原的问题。
:::
### 使用TextMeshPro
@@ -269,7 +305,11 @@ XCharts内部有自动刷新机制但也是在一定条件才会触发。如
2. `chart.RefreshChart()`:刷新图表绘制,只刷新绘制部分,不会刷新组件文本,位置等部分。
3. 各个组件也可以通过`SetAllDirty()`只刷新自己。
>Note用API去操作数据和各种list而不是直接访问list进行处理
:::danger
用API去操作数据和各种list而不是直接访问list进行处理
:::
### 改主组件上的参数
@@ -286,7 +326,11 @@ xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;
```
> 注:低版本没有`EnsureChartComponent()`接口时,用`GetOrAddChartComponent()`
:::note
低版本没有`EnsureChartComponent()`接口时,用`GetOrAddChartComponent()`
:::
### 改Serie的参数

View File

@@ -19,7 +19,11 @@ namespace XCharts.Editor
GameObject selectObj = Selection.activeGameObject;
if (selectObj == null)
{
#if UNITY_2023_1_OR_NEWER
var canvas = UnityEngine.Object.FindFirstObjectByType<Canvas>();
#else
var canvas = GameObject.FindObjectOfType<Canvas>();
#endif
if (canvas != null) return canvas.transform;
else
{

View File

@@ -1,45 +1,37 @@
<h2 align="center">XCharts</h2>
<p align="center">
<a href="">
<img src="" alt="" width="" height="">
</a>
</p>
<h2 align="center">XCharts</h3>
<p align="center">
A powerful, easy-to-use, configurable charting and data visualization library for Unity.
<br>
Unity数据可视化图表插件。
<br>
<a href="https://github.com/XCharts-Team/XCharts">中文文档</a>
A powerful, easy-to-use, configurable charting and data visualization library for Unity.<br/>Unity数据可视化图表插件。<br/>
<a href="https://github.com/XCharts-Team/XCharts">中文文档</a>
</p>
<p align="center">
<a href="https://github.com/XCharts-Team/XCharts/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/XCharts-Team/XCharts">
<img src="https://img.shields.io/github/license/XCharts-Team/XCharts"></img>
</a>
<a href="https://github.com/XCharts-Team/XCharts/releases">
<img src="https://img.shields.io/github/v/release/XCharts-Team/XCharts?include_prereleases">
<img src="https://img.shields.io/github/v/release/XCharts-Team/XCharts?include_prereleases"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts">
<img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts">
<img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts"></img>
</a>
<a href="">
<img src="https://img.shields.io/badge/Unity-5.6+-green">
<img src="https://img.shields.io/badge/Unity-5.6+-green"></img>
</a>
<a href="">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green">
<img src="https://img.shields.io/badge/TextMeshPro-YES-green"></img>
</a>
</p>
<p align="center">
<a href="">
<img src="https://img.shields.io/github/stars/XCharts-Team/XCharts?style=social">
<img src="https://img.shields.io/github/stars/XCharts-Team/XCharts?style=social"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/forks/XCharts-Team/XCharts?style=social">
<img src="https://img.shields.io/github/forks/XCharts-Team/XCharts?style=social"></img>
</a>
<a href="">
<img src="https://img.shields.io/github/issues-closed/XCharts-Team/XCharts?color=green&label=%20%20%20%20issues&logoColor=green&style=social">
<img src="https://img.shields.io/github/issues-closed/XCharts-Team/XCharts?color=green&label=%20%20%20%20issues&logoColor=green&style=social"></img>
</a>
</p>
@@ -47,14 +39,14 @@
## Overview
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, treemap, sankey, line3d and graph chart.
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extension charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, treemap, sankey, line3d and graph chart.
## Key Features
- __Pure Code Rendering__: Charts are rendered with pure code, eliminating the need for extra texture or shader resources.
- __Visual Configuration__: Configure parameters visually with real-time preview and support for dynamic configuration and data adjustments at runtime.
- __High Customizability__: Themes and configuration parameters can be adjusted as needed, with support for custom drawing and callbacks.
- __Built-in and Extended Charts__: Supports a variety of chart types, including 3D charts and special chart types like gauges and treemaps.
- __Built-in and Extension Charts__: Supports a variety of chart types, including 3D charts and special chart types like gauges and treemaps.
- __Multiple Chart Combinations__: Combine multiple charts of the same or different types within a single instance.
- __Various Coordinate Systems__: Supports different coordinate systems such as Cartesian, polar, and single axes.
- __Rich Components__: Includes titles, legends, tooltips, and more.
@@ -67,7 +59,7 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
## Documentation
- [XCharts3.0 Homepage](https://xcharts-team.github.io)
- [XCharts3.0 Homepage](https://xcharts-team.github.io/en)
- [XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
- [XCharts3.0 API](Documentation~/en/api.md)
- [XCharts3.0 FAQ](Documentation~/en/faq.md)
@@ -86,7 +78,7 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
- `XCharts3.0` is not fully compatible with `XCharts2.0`. Upgrading to 3.0 may require code adjustments and reconfiguration of some charts.
- `XCharts2.0` is in the maintenance phase with only critical bug fixes applied.
- While XCharts supports Unity 5.6 and above, compatibility issues may arise due to limited testing.
- This repository contains only the `XCharts` source code. For demos, visit the [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) repo or the [Online Demo](https://xcharts-team.github.io/examples/).
- This repository contains only the `XCharts` source code. For demos, visit the [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) repo or the [Online Demo](https://xcharts-team.github.io/en/examples/).
## Getting Started

View File

@@ -1,15 +1,8 @@
<p align="center">
<a href="">
<img src="" alt="" width="" height=""></img>
</a>
</p>
<h2 align="center">XCharts</h2>
<p align="center">
A powerful, easy-to-use, configurable charting and data visualization library for Unity.
<br/>
Unity数据可视化图表插件。
<br/>
<a href="README-en.md">English README</a>
A powerful, easy-to-use, configurable charting and data visualization library for Unity.<br/>Unity数据可视化图表插件。<br/>
<a href="README-en.md">English README</a>
</p>
<p align="center">
<a href="https://github.com/XCharts-Team/XCharts/blob/master/LICENSE">
@@ -133,10 +126,10 @@
## FAQ
- __XCharts可以免费使用吗__
- __XCharts可以免费使用吗__
`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。
- __XCharts支持代码动态添加和修改数据吗支持从`Excel`或数据库中获取数据吗__
- __XCharts支持代码动态添加和修改数据吗支持从`Excel`或数据库中获取数据吗__
`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
- __XCharts除了用在Unity平台还能用在Winform或WPF等平台吗__

View File

@@ -17,6 +17,8 @@ namespace XCharts.Runtime
private bool m_CheckDataZoomLabel;
private float m_DataZoomLastStartIndex;
private float m_DataZoomLastEndIndex;
private float m_LastStart;
private float m_LastEnd;
public override void InitComponent()
{
@@ -62,6 +64,10 @@ namespace XCharts.Runtime
{
CheckDataZoomScale(component);
CheckDataZoomLabel(component);
if (m_LastStart != component.start || m_LastEnd != component.end)
{
UpdateDataZoomRange(component, component.start, component.end);
}
}
public override void DrawUpper(VertexHelper vh)
@@ -404,6 +410,8 @@ namespace XCharts.Runtime
dataZoom.start = start;
if (!dataZoom.endLock)
dataZoom.end = end;
m_LastStart = dataZoom.start;
m_LastEnd = dataZoom.end;
if (dataZoom.realtime)
{
chart.OnDataZoomRangeChanged(dataZoom);

View File

@@ -39,11 +39,11 @@ namespace XCharts.Runtime
m_LabelObject = ChartHelper.AddChartLabel(s_TitleObjectName, titleObject.transform, title.labelStyle, chart.theme.title,
GetTitleText(title), Color.clear, title.location.runtimeTextAlignment);
m_LabelObject.SetActive(title.show && title.labelStyle.show);
m_LabelObject.SetActive(title.show && title.labelStyle.show, true);
m_SubLabelObject = ChartHelper.AddChartLabel(s_SubTitleObjectName, titleObject.transform, title.subLabelStyle, chart.theme.subTitle,
GetSubTitleText(title), Color.clear, title.location.runtimeTextAlignment);
m_SubLabelObject.SetActive(title.show && title.subLabelStyle.show);
m_SubLabelObject.SetActive(title.show && title.subLabelStyle.show, true);
m_SubLabelObject.transform.localPosition = subTitlePosition + title.subLabelStyle.offset;
};
title.refreshComponent();

View File

@@ -549,37 +549,6 @@ namespace XCharts.Runtime
SetContentActive(flag);
}
/// <summary>
/// 更新文本框位置
/// </summary>
/// <param name="pos"></param>
public void UpdateContentPos(Vector2 pos, float width, float height)
{
if (view != null)
{
switch (m_Position)
{
case Position.Auto:
#if UNITY_ANDROID || UNITY_IOS
if (m_FixedY == 0) pos.y = ChartHelper.GetActualValue(0.7f, height);
else pos.y = ChartHelper.GetActualValue(m_FixedY, height);
#endif
break;
case Position.Custom:
pos.x = ChartHelper.GetActualValue(m_FixedX, width);
pos.y = ChartHelper.GetActualValue(m_FixedY, height);
break;
case Position.FixedX:
pos.x = ChartHelper.GetActualValue(m_FixedX, width);
break;
case Position.FixedY:
pos.y = ChartHelper.GetActualValue(m_FixedY, height);
break;
}
view.UpdatePosition(pos);
}
}
/// <summary>
/// 设置文本框是否显示
/// </summary>

View File

@@ -546,7 +546,7 @@ namespace XCharts.Runtime
tooltip.SetActive(m_ShowTooltip);
tooltip.view.Refresh();
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
TooltipHelper.LimitInRect(chart, tooltip, chart.chartRect);
return true;
}
@@ -633,7 +633,7 @@ namespace XCharts.Runtime
tooltip.SetActive(m_ShowTooltip);
if (tooltip.view != null)
tooltip.view.Refresh();
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
TooltipHelper.LimitInRect(chart, tooltip, chart.chartRect);
return true;
}
return false;

View File

@@ -58,7 +58,7 @@ namespace XCharts.Runtime
return "-".Equals(itemFormatter) ||"{i}".Equals(itemFormatter, StringComparison.CurrentCultureIgnoreCase);
}
public static void LimitInRect(Tooltip tooltip, Rect chartRect)
public static void LimitInRect(BaseChart chart, Tooltip tooltip, Rect chartRect)
{
if (tooltip.view == null)
return;
@@ -78,7 +78,55 @@ namespace XCharts.Runtime
}
if (pos.y > chartRect.y + chartRect.height)
pos.y = chartRect.y + chartRect.height;
tooltip.UpdateContentPos(pos, chartRect.width / 2, chartRect.height / 2);
var screenGap = 10;
var screenPos = chart.LocalPointToScreenPoint(pos);
if (screenPos.x < screenGap)
pos.x += Mathf.Abs(screenPos.x) + screenGap;
if (screenPos.x + tooltip.context.width > Screen.width - screenGap)
pos.x -= Mathf.Abs(screenPos.x + tooltip.context.width - Screen.width) + screenGap;
if (screenPos.y < tooltip.context.height + screenGap)
pos.y += Mathf.Abs(screenPos.y - tooltip.context.height) + screenGap;
if (screenPos.y > Screen.height - screenGap)
pos.y -= Mathf.Abs(screenPos.y - Screen.height) + screenGap;
UpdateContentPos(tooltip, pos, chartRect);
}
/// <summary>
/// 更新文本框位置
/// </summary>
/// <param name="pos"></param>
private static void UpdateContentPos(Tooltip tooltip, Vector2 pos, Rect chartRect)
{
if (tooltip.view != null)
{
var width = chartRect.width;
var height = chartRect.height;
switch (tooltip.position)
{
case Tooltip.Position.Auto:
#if UNITY_ANDROID || UNITY_IOS
if (tooltip.fixedY == 0) pos.y = chartRect.x + ChartHelper.GetActualValue(0.7f, height);
else pos.y = chartRect.y + ChartHelper.GetActualValue(tooltip.fixedY, height);
#endif
break;
case Tooltip.Position.Custom:
pos = new Vector2(chartRect.x, chartRect.y);
pos.x += ChartHelper.GetActualValue(tooltip.fixedX, width);
pos.y += ChartHelper.GetActualValue(tooltip.fixedY, height);
break;
case Tooltip.Position.FixedX:
pos = new Vector2(chartRect.x, pos.y);
pos.x += ChartHelper.GetActualValue(tooltip.fixedX, width);
break;
case Tooltip.Position.FixedY:
pos = new Vector2(pos.x, chartRect.y);
pos.y += ChartHelper.GetActualValue(tooltip.fixedY, height);
break;
}
tooltip.view.UpdatePosition(pos);
}
}
public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)

View File

@@ -656,10 +656,12 @@ namespace XCharts.Runtime
}
}
private Background m_Background;
public Color32 GetChartBackgroundColor()
{
var background = GetChartComponent<Background>();
return theme.GetBackgroundColor(background);
if (m_Background == null) m_Background = GetChartComponent<Background>();
//var background = GetChartComponent<Background>();
return theme.GetBackgroundColor(m_Background);
}
/// <summary>

View File

@@ -21,8 +21,8 @@ namespace XCharts.Runtime
[ExecuteInEditMode]
public static class XChartsMgr
{
public static readonly string version = "3.12.0";
public static readonly int versionDate = 20240930;
public static readonly string version = "3.12.1";
public static readonly int versionDate = 20241201;
public static string fullVersion { get { return version + "-" + versionDate; } }
internal static List<BaseChart> chartList = new List<BaseChart>();

View File

@@ -2007,8 +2007,11 @@ namespace XCharts.Runtime
/// </summary>
public void AnimationEnable(bool flag)
{
if (animation.enable) animation.enable = flag;
SetVerticesDirty();
if (animation.enable != flag)
{
animation.enable = flag;
SetVerticesDirty();
}
}
/// <summary>

View File

@@ -161,6 +161,7 @@ namespace XCharts.Runtime
? (new DateTime(dtMin.Year, dtMin.Month, 1).AddMonths(1))
: (minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
tick = num * 365 * 24 * 3600;
dtStart = new DateTime(dtStart.Year, dtStart.Month, 1);
while (dtStart.Ticks < dtMax.Ticks)
{
list.Add(DateTimeUtil.GetTimestamp(dtStart));
@@ -173,6 +174,7 @@ namespace XCharts.Runtime
var dtStart = (firstValue == 0 || secondValue == 0 || (minTimestamp > firstValue && minTimestamp > secondValue))
? (new DateTime(dtMin.Year, dtMin.Month, 1).AddMonths(1))
: (minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
dtStart = new DateTime(dtStart.Year, dtStart.Month, 1);
tick = num * 30 * 24 * 3600;
while (dtStart.Ticks < dtMax.Ticks)
{

View File

@@ -4,6 +4,7 @@ using System;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEditor.Build;
using UnityEngine;
namespace XCharts.Runtime
@@ -16,6 +17,22 @@ namespace XCharts.Runtime
{
var flag = false;
var num = 0;
#if UNITY_2022_1_OR_NEWER
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
var buildTargetName = NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
var symbols = PlayerSettings.GetScriptingDefineSymbols(buildTargetName);
symbols = symbols.Replace(" ", "");
if (Array.IndexOf(symbols.Split(';'), symbol) != -1) continue;
flag = true;
num++;
var defines = symbols + (symbols.Length > 0 ? ";" + symbol : symbol);
PlayerSettings.SetScriptingDefineSymbols(buildTargetName, defines);
}
}
#else
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
@@ -29,6 +46,7 @@ namespace XCharts.Runtime
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, defines);
}
}
#endif
if (flag)
{
Debug.LogFormat("Added global define symbol \"{0}\" to {1} BuildTargetGroups.", symbol, num);
@@ -39,6 +57,29 @@ namespace XCharts.Runtime
{
var flag = false;
var num = 0;
#if UNITY_2022_1_OR_NEWER
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
{
var buildTargetName = NamedBuildTarget.FromBuildTargetGroup(buildTargetGroup);
var symbols = PlayerSettings.GetScriptingDefineSymbols(buildTargetName).Split(';');
if (Array.IndexOf(symbols, symbol) == -1) continue;
flag = true;
num++;
s_StringBuilder.Length = 0;
foreach (var str in symbols)
{
if (!str.Equals(symbol))
{
if (s_StringBuilder.Length > 0) s_StringBuilder.Append(";");
s_StringBuilder.Append(str);
}
}
PlayerSettings.SetScriptingDefineSymbols(buildTargetName, s_StringBuilder.ToString());
}
}
#else
foreach (var buildTargetGroup in (BuildTargetGroup[]) Enum.GetValues(typeof(BuildTargetGroup)))
{
if (IsValidBuildTargetGroup(buildTargetGroup))
@@ -59,6 +100,7 @@ namespace XCharts.Runtime
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, s_StringBuilder.ToString());
}
}
#endif
if (flag)
{
Debug.LogFormat("Removed global define symbol \"{0}\" to {1} BuildTargetGroups.", symbol, num);

View File

@@ -259,17 +259,27 @@ namespace XUGL
/// <returns>相交则返回 true, 否则返回 false</returns>
public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)
{
var d = (p2.x - p1.x) * (p4.y - p3.y) - (p2.y - p1.y) * (p4.x - p3.x);
if (d == 0)
float dx1 = p2.x - p1.x;
float dy1 = p2.y - p1.y;
float dx2 = p4.x - p3.x;
float dy2 = p4.y - p3.y;
float d = dx1 * dy2 - dy1 * dx2;
if (Mathf.Abs(d) < 1e-6f)
return false;
var u = ((p3.x - p1.x) * (p4.y - p3.y) - (p3.y - p1.y) * (p4.x - p3.x)) / d;
var v = ((p3.x - p1.x) * (p2.y - p1.y) - (p3.y - p1.y) * (p2.x - p1.x)) / d;
if (u < 0 || u > 1 || v < 0 || v > 1)
return false;
float dx3 = p3.x - p1.x;
float dy3 = p3.y - p1.y;
intersection.x = p1.x + u * (p2.x - p1.x);
intersection.y = p1.y + u * (p2.y - p1.y);
float u = (dx3 * dy2 - dy3 * dx2) / d;
if (u < 0 || u > 1) return false;
float v = (dx3 * dy1 - dy3 * dx1) / d;
if (v < 0 || v > 1) return false;
intersection.x = p1.x + u * dx1;
intersection.y = p1.y + u * dy1;
intersection.z = p1.z;
return true;
}
@@ -337,40 +347,93 @@ namespace XUGL
clp = cp - dir2v;
crp = cp + dir2v;
if (Vector3.Cross(dir1, dir2) == Vector3.zero && np != cp)
float crossMagnitude = Vector3.Cross(dir1, dir2).sqrMagnitude;
if (crossMagnitude < 1e-6f && np != cp)
{
itp = clp;
ibp = crp;
return;
}
var ldist = (Vector3.Distance(cp, lp) + 1) * dir1;
var rdist = (Vector3.Distance(cp, np) + 1) * dir2;
var ldist = (Vector3.Distance(cp, lp) + width) * dir1;
var rdist = (Vector3.Distance(cp, np) + width) * dir2;
bitp = true;
if (!UGLHelper.GetIntersection(ltp, ltp + ldist, ntp, ntp + rdist, ref itp))
bitp = UGLHelper.GetIntersection(ltp, ltp + ldist, ntp, ntp + rdist, ref itp);
bibp = UGLHelper.GetIntersection(lbp, lbp + ldist, nbp, nbp + rdist, ref ibp);
if (bitp == bibp)
{
itp = cp - dir1v;
clp = cp - dir1v;
crp = cp - dir2v;
bitp = false;
if (!bitp)
{
if (cp == np)
{
ltp = cp - dir1v;
clp = cp + dir1v;
crp = cp + dir1v;
}
else
{
Vector3 ibp2 = Vector3.zero;
if (UGLHelper.GetIntersection(lbp, lbp + ldist, ntp, nbp, ref ibp2))
{
bibp = true;
ibp = ibp2;
clp = cp - dir1v;
crp = cp - dir2v;
}
else if (UGLHelper.GetIntersection(ltp, ltp + ldist, nbp, ntp, ref ibp2))
{
bitp = true;
itp = ibp2;
clp = cp + dir1v;
crp = cp + dir2v;
}
else
{
if (IsUp(lp, cp, np))
{
bibp = true;
clp = cp - dir1v;
crp = cp - dir2v;
ibp = cp - Vector3.Cross((crp - clp).normalized, Vector3.back).normalized * width * 2f;
}
else
{
bitp = true;
clp = cp + dir1v;
crp = cp + dir2v;
itp = cp + Vector3.Cross((crp - clp).normalized, Vector3.back).normalized * width * 2f;
}
}
}
}
}
bibp = true;
if (!UGLHelper.GetIntersection(lbp, lbp + ldist, nbp, nbp + rdist, ref ibp))
else
{
ibp = cp + dir1v;
clp = cp + dir1v;
crp = cp + dir2v;
bibp = false;
}
if (bitp == false && bibp == false && cp == np)
{
ltp = cp - dir1v;
clp = cp + dir1v;
crp = cp + dir1v;
if (!bitp)
{
itp = cp;
clp = cp - dir1v;
crp = cp - dir2v;
}
else
{
ibp = cp;
clp = cp + dir1v;
crp = cp + dir2v;
}
}
}
public static bool IsUp(Vector3 p1, Vector3 p2, Vector3 p3)
{
var v1 = p1 - p2;
var v2 = p3 - p2;
var cross = v1.x * v2.y - v1.y * v2.x;
return cross > 0;
}
public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)
{
var dire1 = check - p1;

View File

@@ -3,9 +3,9 @@
"displayName": "XCharts",
"author": "monitor1394",
"license": "MIT",
"version": "3.12.0",
"date": "20240930",
"checkdate": "20240930",
"version": "3.12.1",
"date": "20241201",
"checkdate": "20241201",
"unity": "2018.3",
"description": "A charting and data visualization library for Unity. Support line chart, bar chart, pie chart, radar chart, scatter chart, heatmap chart, ring chart, candlestick chart, polar chart and parallel coordinates.",
"keywords": [