mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 05:08:48 +00:00
增加Tooltip的Auto自动设置显示类型和触发类型
This commit is contained in:
@@ -31,6 +31,7 @@ slug: /api
|
|||||||
- [DataZoomHelper](#datazoomhelper)
|
- [DataZoomHelper](#datazoomhelper)
|
||||||
- [DateTimeUtil](#datetimeutil)
|
- [DateTimeUtil](#datetimeutil)
|
||||||
- [DefaultAnimationAttribute](#defaultanimationattribute)
|
- [DefaultAnimationAttribute](#defaultanimationattribute)
|
||||||
|
- [DefaultTooltipAttribute](#defaulttooltipattribute)
|
||||||
- [DefineSymbolsUtil](#definesymbolsutil)
|
- [DefineSymbolsUtil](#definesymbolsutil)
|
||||||
- [FormatterHelper](#formatterhelper)
|
- [FormatterHelper](#formatterhelper)
|
||||||
- [GridCoordContext](#gridcoordcontext)
|
- [GridCoordContext](#gridcoordcontext)
|
||||||
@@ -609,6 +610,14 @@ slug: /api
|
|||||||
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)|
|
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)|
|
||||||
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler, bool enableSerieDataAddedAnimation)|
|
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler, bool enableSerieDataAddedAnimation)|
|
||||||
|
|
||||||
|
## DefaultTooltipAttribute
|
||||||
|
|
||||||
|
> XCharts.Runtime.DefaultTooltipAttribute : [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute)
|
||||||
|
|
||||||
|
|public method|since|description|
|
||||||
|
|--|--|--|
|
||||||
|
|DefaultTooltipAttribute()||public DefaultTooltipAttribute(Tooltip.Type type, Tooltip.Trigger trigger)|
|
||||||
|
|
||||||
## DefineSymbolsUtil
|
## DefineSymbolsUtil
|
||||||
|
|
||||||
> XCharts.Runtime.DefineSymbolsUtil
|
> XCharts.Runtime.DefineSymbolsUtil
|
||||||
|
|||||||
@@ -2196,8 +2196,8 @@ Tooltip component.
|
|||||||
|field|default|since|comment|
|
|field|default|since|comment|
|
||||||
|--|--|--|--|
|
|--|--|--|--|
|
||||||
|show|true||Whether to show the tooltip component.
|
|show|true||Whether to show the tooltip component.
|
||||||
|type|||Indicator type.<br/>`Tooltip.Type`:<br/>- `Line`: line indicator.<br/>- `Shadow`: shadow crosshair indicator.<br/>- `None`: no indicator displayed.<br/>- `Corss`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.<br/>|
|
|type|||Indicator type.<br/>`Tooltip.Type`:<br/>- `Line`: line indicator.<br/>- `Shadow`: shadow crosshair indicator.<br/>- `None`: no indicator displayed.<br/>- `Corss`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.<br/>- `Auto`: Auto select indicator according to serie type.<br/>|
|
||||||
|trigger|||Type of triggering.<br/>`Tooltip.Trigger`:<br/>- `Item`: Triggered by data item, which is mainly used for charts that don't have a category axis like scatter charts or pie charts.<br/>- `Axis`: Triggered by axes, which is mainly used for charts that have category axes, like bar charts or line charts.<br/>- `None`: Trigger nothing.<br/>|
|
|trigger|||Type of triggering.<br/>`Tooltip.Trigger`:<br/>- `Item`: Triggered by data item, which is mainly used for charts that don't have a category axis like scatter charts or pie charts.<br/>- `Axis`: Triggered by axes, which is mainly used for charts that have category axes, like bar charts or line charts.<br/>- `None`: Trigger nothing.<br/>- `Auto`: Auto select trigger according to serie type.<br/>|
|
||||||
|position||v3.3.0|Type of position.<br/>`Tooltip.Position`:<br/>- `Auto`: Auto. The mobile platform is displayed at the top, and the non-mobile platform follows the mouse position.<br/>- `Custom`: Custom. Fully customize display position (x,y).<br/>- `FixedX`: Just fix the coordinate X. Y follows the mouse position.<br/>- `FixedY`: <br/>|
|
|position||v3.3.0|Type of position.<br/>`Tooltip.Position`:<br/>- `Auto`: Auto. The mobile platform is displayed at the top, and the non-mobile platform follows the mouse position.<br/>- `Custom`: Custom. Fully customize display position (x,y).<br/>- `FixedX`: Just fix the coordinate X. Y follows the mouse position.<br/>- `FixedY`: <br/>|
|
||||||
|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/> {.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/>
|
|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/> {.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/>
|
||||||
|titleFormatter|||The string template formatter for the tooltip title content. Support for wrapping lines with \n. The placeholder {I} can be set separately to indicate that the title is ignored and not displayed. Template see itemFormatter.
|
|titleFormatter|||The string template formatter for the tooltip title content. Support for wrapping lines with \n. The placeholder {I} can be set separately to indicate that the title is ignored and not displayed. Template see itemFormatter.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ slug: /api
|
|||||||
- [DataZoomHelper](#datazoomhelper)
|
- [DataZoomHelper](#datazoomhelper)
|
||||||
- [DateTimeUtil](#datetimeutil)
|
- [DateTimeUtil](#datetimeutil)
|
||||||
- [DefaultAnimationAttribute](#defaultanimationattribute)
|
- [DefaultAnimationAttribute](#defaultanimationattribute)
|
||||||
|
- [DefaultTooltipAttribute](#defaulttooltipattribute)
|
||||||
- [DefineSymbolsUtil](#definesymbolsutil)
|
- [DefineSymbolsUtil](#definesymbolsutil)
|
||||||
- [FormatterHelper](#formatterhelper)
|
- [FormatterHelper](#formatterhelper)
|
||||||
- [GridCoordContext](#gridcoordcontext)
|
- [GridCoordContext](#gridcoordcontext)
|
||||||
@@ -609,6 +610,14 @@ slug: /api
|
|||||||
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)|
|
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)|
|
||||||
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler, bool enableSerieDataAddedAnimation)|
|
|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler, bool enableSerieDataAddedAnimation)|
|
||||||
|
|
||||||
|
## DefaultTooltipAttribute
|
||||||
|
|
||||||
|
> XCharts.Runtime.DefaultTooltipAttribute : [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute)
|
||||||
|
|
||||||
|
|public method|since|description|
|
||||||
|
|--|--|--|
|
||||||
|
|DefaultTooltipAttribute()||public DefaultTooltipAttribute(Tooltip.Type type, Tooltip.Trigger trigger)|
|
||||||
|
|
||||||
## DefineSymbolsUtil
|
## DefineSymbolsUtil
|
||||||
|
|
||||||
> XCharts.Runtime.DefineSymbolsUtil
|
> XCharts.Runtime.DefineSymbolsUtil
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ slug: /changelog
|
|||||||
|
|
||||||
日志详情:
|
日志详情:
|
||||||
|
|
||||||
|
* (2023.09.01) 增加`Tooltip`的`Auto`自动设置显示类型和触发类型
|
||||||
* (2023.08.29) 增加`Ring`的`gridIndex`支持设置指定网格
|
* (2023.08.29) 增加`Ring`的`gridIndex`支持设置指定网格
|
||||||
* (2023.08.29) 增加`Radar`的`gridIndex`支持设置指定网格
|
* (2023.08.29) 增加`Radar`的`gridIndex`支持设置指定网格
|
||||||
* (2023.08.29) 增加`Pie`的`gridIndex`支持设置指定网格
|
* (2023.08.29) 增加`Pie`的`gridIndex`支持设置指定网格
|
||||||
|
|||||||
@@ -2196,8 +2196,8 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
|||||||
|field|default|since|comment|
|
|field|default|since|comment|
|
||||||
|--|--|--|--|
|
|--|--|--|--|
|
||||||
|show|true||是否显示提示框组件。
|
|show|true||是否显示提示框组件。
|
||||||
|type|||提示框指示器类型。<br/>`Tooltip.Type`:<br/>- `Line`: 直线指示器<br/>- `Shadow`: 阴影指示器<br/>- `None`: 无指示器<br/>- `Corss`: 十字准星指示器。坐标轴显示Label和交叉线。<br/>|
|
|type|||提示框指示器类型。<br/>`Tooltip.Type`:<br/>- `Line`: 直线指示器<br/>- `Shadow`: 阴影指示器<br/>- `None`: 无指示器<br/>- `Corss`: 十字准星指示器。坐标轴显示Label和交叉线。<br/>- `Auto`: 根据serie的类型自动选择显示指示器。<br/>|
|
||||||
|trigger|||触发类型。<br/>`Tooltip.Trigger`:<br/>- `Item`: 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。<br/>- `Axis`: 坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。<br/>- `None`: 什么都不触发。<br/>|
|
|trigger|||触发类型。<br/>`Tooltip.Trigger`:<br/>- `Item`: 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。<br/>- `Axis`: 坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。<br/>- `None`: 什么都不触发。<br/>- `Auto`: 根据serie的类型自动选择触发类型。<br/>|
|
||||||
|position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>|
|
|position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>|
|
||||||
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用
|
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用
|
||||||
|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/> {.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}"
|
|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/> {.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}"
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = EnsureChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Shadow;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = EnsureChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Shadow;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
var serie = Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
var serie = Candlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
var tooltip = GetChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.None;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
var grid = EnsureChartComponent<GridCoord>();
|
var grid = EnsureChartComponent<GridCoord>();
|
||||||
grid.left = 0.12f;
|
grid.left = 0.12f;
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = EnsureChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Line;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<PolarCoord>();
|
EnsureChartComponent<PolarCoord>();
|
||||||
AddChartComponentWhenNoExist<AngleAxis>();
|
EnsureChartComponent<AngleAxis>();
|
||||||
AddChartComponentWhenNoExist<RadiusAxis>();
|
EnsureChartComponent<RadiusAxis>();
|
||||||
|
|
||||||
var tooltip = GetChartComponent<Tooltip>();
|
var tooltip = EnsureChartComponent<Tooltip>();
|
||||||
tooltip.type = Tooltip.Type.Corss;
|
tooltip.type = Tooltip.Type.Corss;
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
|
|
||||||
var tooltip = EnsureChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.None;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Item;
|
|
||||||
|
|
||||||
var xAxis = EnsureChartComponent<XAxis>();
|
var xAxis = EnsureChartComponent<XAxis>();
|
||||||
xAxis.type = Axis.AxisType.Value;
|
xAxis.type = Axis.AxisType.Value;
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = GetChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Line;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
SimplifiedBar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
SimplifiedBar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = GetChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Shadow;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
SimplifiedCandlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
SimplifiedCandlestick.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
protected override void DefaultChart()
|
protected override void DefaultChart()
|
||||||
{
|
{
|
||||||
AddChartComponentWhenNoExist<GridCoord>();
|
EnsureChartComponent<GridCoord>();
|
||||||
AddChartComponentWhenNoExist<XAxis>();
|
EnsureChartComponent<XAxis>();
|
||||||
AddChartComponentWhenNoExist<YAxis>();
|
EnsureChartComponent<YAxis>();
|
||||||
|
|
||||||
var tooltip = GetChartComponent<Tooltip>();
|
|
||||||
tooltip.type = Tooltip.Type.Line;
|
|
||||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
|
||||||
|
|
||||||
RemoveData();
|
RemoveData();
|
||||||
SimplifiedLine.AddDefaultSerie(this, GenerateDefaultSerieName());
|
SimplifiedLine.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ namespace XCharts.Runtime
|
|||||||
if (center.Length < 2) return;
|
if (center.Length < 2) return;
|
||||||
var chartPosition = chart.chartPosition;
|
var chartPosition = chart.chartPosition;
|
||||||
var chartWidth = chart.chartWidth;
|
var chartWidth = chart.chartWidth;
|
||||||
var chartHeight = chart.chartWidth;
|
var chartHeight = chart.chartHeight;
|
||||||
if (gridIndex >= 0)
|
if (gridIndex >= 0)
|
||||||
{
|
{
|
||||||
var layout = chart.GetChartComponent<GridLayout>(0);
|
var layout = chart.GetChartComponent<GridLayout>(0);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using XUGL;
|
|
||||||
|
|
||||||
namespace XCharts.Runtime
|
namespace XCharts.Runtime
|
||||||
{
|
{
|
||||||
@@ -39,7 +37,12 @@ namespace XCharts.Runtime
|
|||||||
/// crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
|
/// crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
|
||||||
/// |十字准星指示器。坐标轴显示Label和交叉线。
|
/// |十字准星指示器。坐标轴显示Label和交叉线。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Corss
|
Corss,
|
||||||
|
/// <summary>
|
||||||
|
/// Auto select indicator according to serie type.
|
||||||
|
/// |根据serie的类型自动选择显示指示器。
|
||||||
|
/// </summary>
|
||||||
|
Auto
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,7 +65,12 @@ namespace XCharts.Runtime
|
|||||||
/// Trigger nothing.
|
/// Trigger nothing.
|
||||||
/// |什么都不触发。
|
/// |什么都不触发。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// Auto select trigger according to serie type.
|
||||||
|
/// |根据serie的类型自动选择触发类型。
|
||||||
|
/// </summary>
|
||||||
|
Auto
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Position type.
|
/// Position type.
|
||||||
@@ -92,8 +100,8 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SerializeField] private bool m_Show = true;
|
[SerializeField] private bool m_Show = true;
|
||||||
[SerializeField] private Type m_Type;
|
[SerializeField] private Type m_Type = Type.Auto;
|
||||||
[SerializeField] private Trigger m_Trigger = Trigger.Item;
|
[SerializeField] private Trigger m_Trigger = Trigger.Auto;
|
||||||
[SerializeField][Since("v3.3.0")] private Position m_Position = Position.Auto;
|
[SerializeField][Since("v3.3.0")] private Position m_Position = Position.Auto;
|
||||||
[SerializeField] private string m_ItemFormatter;
|
[SerializeField] private string m_ItemFormatter;
|
||||||
[SerializeField] private string m_TitleFormatter;
|
[SerializeField] private string m_TitleFormatter;
|
||||||
@@ -429,7 +437,7 @@ namespace XCharts.Runtime
|
|||||||
/// |当前提示框所指示的数据项索引。
|
/// |当前提示框所指示的数据项索引。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int> runtimeDataIndex { get { return m_RuntimeDateIndex; } internal set { m_RuntimeDateIndex = value; } }
|
public List<int> runtimeDataIndex { get { return m_RuntimeDateIndex; } internal set { m_RuntimeDateIndex = value; } }
|
||||||
private List<int> m_RuntimeDateIndex = new List<int>() {-1, -1 };
|
private List<int> m_RuntimeDateIndex = new List<int>() { -1, -1 };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Keep Tooltiop displayed at the top.
|
/// Keep Tooltiop displayed at the top.
|
||||||
@@ -569,12 +577,12 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public bool IsTriggerItem()
|
public bool IsTriggerItem()
|
||||||
{
|
{
|
||||||
return trigger == Trigger.Item;
|
return trigger == Trigger.Auto ? context.trigger == Trigger.Item : trigger == Trigger.Item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsTriggerAxis()
|
public bool IsTriggerAxis()
|
||||||
{
|
{
|
||||||
return trigger == Trigger.Axis;
|
return trigger == Trigger.Auto ? context.trigger == Trigger.Axis : trigger == Trigger.Axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LabelStyle GetContentLabelStyle(int index)
|
public LabelStyle GetContentLabelStyle(int index)
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace XCharts.Runtime
|
|||||||
public float width;
|
public float width;
|
||||||
public float height;
|
public float height;
|
||||||
public float angle;
|
public float angle;
|
||||||
|
public Tooltip.Type type;
|
||||||
|
public Tooltip.Trigger trigger;
|
||||||
public TooltipData data = new TooltipData();
|
public TooltipData data = new TooltipData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var containerSeries = ListPool<Serie>.Get();
|
var containerSeries = ListPool<Serie>.Get();
|
||||||
m_PointerContainer = GetPointerContainerAndSeries(tooltip, containerSeries);
|
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref containerSeries);
|
||||||
if (containerSeries.Count > 0)
|
if (containerSeries.Count > 0)
|
||||||
{
|
{
|
||||||
if (SetSerieTooltip(tooltip, containerSeries))
|
if (SetSerieTooltip(tooltip, containerSeries))
|
||||||
@@ -122,7 +122,7 @@ namespace XCharts.Runtime
|
|||||||
ListPool<Serie>.Release(containerSeries);
|
ListPool<Serie>.Release(containerSeries);
|
||||||
if (!showTooltip)
|
if (!showTooltip)
|
||||||
{
|
{
|
||||||
if (tooltip.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
||||||
{
|
{
|
||||||
tooltip.SetActive(true);
|
tooltip.SetActive(true);
|
||||||
tooltip.SetContentActive(false);
|
tooltip.SetContentActive(false);
|
||||||
@@ -138,13 +138,17 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateTooltipTypeAndTrigger(Tooltip tootip)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateTooltipIndicatorLabelText(Tooltip tooltip)
|
private void UpdateTooltipIndicatorLabelText(Tooltip tooltip)
|
||||||
{
|
{
|
||||||
if (!tooltip.show) return;
|
if (!tooltip.show) return;
|
||||||
if (tooltip.type == Tooltip.Type.None) return;
|
if (tooltip.context.type == Tooltip.Type.None) return;
|
||||||
if (m_PointerContainer != null)
|
if (m_PointerContainer != null)
|
||||||
{
|
{
|
||||||
if (tooltip.type == Tooltip.Type.Corss)
|
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
if (m_PointerContainer is GridCoord)
|
if (m_PointerContainer is GridCoord)
|
||||||
{
|
{
|
||||||
@@ -218,10 +222,11 @@ namespace XCharts.Runtime
|
|||||||
label.SetTextColor(axis.indicatorLabel.textStyle.color);
|
label.SetTextColor(axis.indicatorLabel.textStyle.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISerieContainer GetPointerContainerAndSeries(Tooltip tooltip, List<Serie> list)
|
private void UpdatePointerContainerAndSeriesAndTooltip(Tooltip tooltip, ref List<Serie> list)
|
||||||
{
|
{
|
||||||
list.Clear();
|
list.Clear();
|
||||||
ISerieContainer target = null;
|
m_PointerContainer = null;
|
||||||
|
var updateTooltipTypeAndTrigger = false;
|
||||||
for (int i = chart.components.Count - 1; i >= 0; i--)
|
for (int i = chart.components.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var component = chart.components[i];
|
var component = chart.components[i];
|
||||||
@@ -236,6 +241,14 @@ namespace XCharts.Runtime
|
|||||||
(serie as INeedSerieContainer).containterInstanceId == component.instanceId &&
|
(serie as INeedSerieContainer).containterInstanceId == component.instanceId &&
|
||||||
!serie.placeHolder)
|
!serie.placeHolder)
|
||||||
{
|
{
|
||||||
|
if (!updateTooltipTypeAndTrigger)
|
||||||
|
{
|
||||||
|
updateTooltipTypeAndTrigger = true;
|
||||||
|
tooltip.context.type = tooltip.type == Tooltip.Type.Auto ?
|
||||||
|
serie.context.tooltipType : tooltip.type;
|
||||||
|
tooltip.context.trigger = tooltip.trigger == Tooltip.Trigger.Auto ?
|
||||||
|
serie.context.tooltipTrigger : tooltip.trigger;
|
||||||
|
}
|
||||||
var isTriggerAxis = tooltip.IsTriggerAxis();
|
var isTriggerAxis = tooltip.IsTriggerAxis();
|
||||||
if (container is GridCoord)
|
if (container is GridCoord)
|
||||||
{
|
{
|
||||||
@@ -253,16 +266,16 @@ namespace XCharts.Runtime
|
|||||||
chart.RefreshTopPainter();
|
chart.RefreshTopPainter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target = container;
|
m_PointerContainer = container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||||
{
|
{
|
||||||
serie.context.pointerAxisDataIndexs.Clear();
|
serie.context.pointerAxisDataIndexs.Clear();
|
||||||
|
if (xAxis == null || yAxis == null) return;
|
||||||
if (serie is Heatmap)
|
if (serie is Heatmap)
|
||||||
{
|
{
|
||||||
GetSerieDataByXYAxis(serie, xAxis, yAxis);
|
GetSerieDataByXYAxis(serie, xAxis, yAxis);
|
||||||
@@ -419,9 +432,10 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
private bool SetSerieTooltip(Tooltip tooltip, Serie serie)
|
private bool SetSerieTooltip(Tooltip tooltip, Serie serie)
|
||||||
{
|
{
|
||||||
if (tooltip.trigger == Tooltip.Trigger.None) return false;
|
|
||||||
if (serie.context.pointerItemDataIndex < 0) return false;
|
if (serie.context.pointerItemDataIndex < 0) return false;
|
||||||
|
tooltip.context.type = tooltip.type == Tooltip.Type.Auto ? serie.context.tooltipType : tooltip.type;
|
||||||
|
tooltip.context.trigger = tooltip.trigger == Tooltip.Trigger.Auto ? serie.context.tooltipTrigger : tooltip.trigger;
|
||||||
|
if (tooltip.context.trigger == Tooltip.Trigger.None) return false;
|
||||||
tooltip.context.data.param.Clear();
|
tooltip.context.data.param.Clear();
|
||||||
tooltip.context.data.title = serie.serieName;
|
tooltip.context.data.title = serie.serieName;
|
||||||
tooltip.context.pointer = chart.pointerPos;
|
tooltip.context.pointer = chart.pointerPos;
|
||||||
@@ -440,7 +454,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
private bool SetSerieTooltip(Tooltip tooltip, List<Serie> series)
|
private bool SetSerieTooltip(Tooltip tooltip, List<Serie> series)
|
||||||
{
|
{
|
||||||
if (tooltip.trigger == Tooltip.Trigger.None)
|
if (tooltip.context.trigger == Tooltip.Trigger.None)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (series.Count <= 0)
|
if (series.Count <= 0)
|
||||||
@@ -456,7 +470,7 @@ namespace XCharts.Runtime
|
|||||||
if (m_PointerContainer is GridCoord)
|
if (m_PointerContainer is GridCoord)
|
||||||
{
|
{
|
||||||
GetAxisCategory(m_PointerContainer.index, ref dataIndex, ref category);
|
GetAxisCategory(m_PointerContainer.index, ref dataIndex, ref category);
|
||||||
if (tooltip.trigger == Tooltip.Trigger.Axis)
|
if (tooltip.context.trigger == Tooltip.Trigger.Axis)
|
||||||
{
|
{
|
||||||
isTriggerByAxis = true;
|
isTriggerByAxis = true;
|
||||||
if (series.Count <= 1)
|
if (series.Count <= 1)
|
||||||
@@ -467,7 +481,7 @@ namespace XCharts.Runtime
|
|||||||
else
|
else
|
||||||
tooltip.context.data.title = category;
|
tooltip.context.data.title = category;
|
||||||
}
|
}
|
||||||
else if (tooltip.trigger == Tooltip.Trigger.Item)
|
else if (tooltip.context.trigger == Tooltip.Trigger.Item)
|
||||||
{
|
{
|
||||||
isTriggerByItem = true;
|
isTriggerByItem = true;
|
||||||
showCategory = series.Count <= 1;
|
showCategory = series.Count <= 1;
|
||||||
@@ -523,7 +537,7 @@ namespace XCharts.Runtime
|
|||||||
private void DrawTooltipIndicator(VertexHelper vh, Tooltip tooltip)
|
private void DrawTooltipIndicator(VertexHelper vh, Tooltip tooltip)
|
||||||
{
|
{
|
||||||
if (!tooltip.show) return;
|
if (!tooltip.show) return;
|
||||||
if (tooltip.type == Tooltip.Type.None) return;
|
if (tooltip.context.type == Tooltip.Type.None) return;
|
||||||
if (!IsAnySerieNeedTooltip()) return;
|
if (!IsAnySerieNeedTooltip()) return;
|
||||||
if (m_PointerContainer is GridCoord)
|
if (m_PointerContainer is GridCoord)
|
||||||
{
|
{
|
||||||
@@ -566,7 +580,7 @@ namespace XCharts.Runtime
|
|||||||
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
|
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
|
||||||
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
||||||
float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom);
|
float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom);
|
||||||
switch (tooltip.type)
|
switch (tooltip.context.type)
|
||||||
{
|
{
|
||||||
case Tooltip.Type.Corss:
|
case Tooltip.Type.Corss:
|
||||||
case Tooltip.Type.Line:
|
case Tooltip.Type.Line:
|
||||||
@@ -580,7 +594,7 @@ namespace XCharts.Runtime
|
|||||||
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
|
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
|
||||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
||||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||||
if (tooltip.type == Tooltip.Type.Corss)
|
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
sp = new Vector2(grid.context.x, chart.pointerPos.y);
|
sp = new Vector2(grid.context.x, chart.pointerPos.y);
|
||||||
ep = new Vector2(grid.context.x + grid.context.width, chart.pointerPos.y);
|
ep = new Vector2(grid.context.x + grid.context.width, chart.pointerPos.y);
|
||||||
@@ -632,7 +646,7 @@ namespace XCharts.Runtime
|
|||||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||||
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
int dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
|
||||||
float splitWidth = AxisHelper.GetDataWidth(yAxis, grid.context.height, dataCount, dataZoom);
|
float splitWidth = AxisHelper.GetDataWidth(yAxis, grid.context.height, dataCount, dataZoom);
|
||||||
switch (tooltip.type)
|
switch (tooltip.context.type)
|
||||||
{
|
{
|
||||||
case Tooltip.Type.Corss:
|
case Tooltip.Type.Corss:
|
||||||
case Tooltip.Type.Line:
|
case Tooltip.Type.Line:
|
||||||
@@ -644,7 +658,7 @@ namespace XCharts.Runtime
|
|||||||
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
|
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
|
||||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
||||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||||
if (tooltip.type == Tooltip.Type.Corss)
|
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
sp = new Vector2(chart.pointerPos.x, grid.context.y);
|
sp = new Vector2(chart.pointerPos.x, grid.context.y);
|
||||||
ep = new Vector2(chart.pointerPos.x, grid.context.y + grid.context.height);
|
ep = new Vector2(chart.pointerPos.x, grid.context.y + grid.context.height);
|
||||||
@@ -687,7 +701,7 @@ namespace XCharts.Runtime
|
|||||||
var sp = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.insideRadius, tooltipAngle, true);
|
var sp = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.insideRadius, tooltipAngle, true);
|
||||||
var ep = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.outsideRadius, tooltipAngle, true);
|
var ep = ChartHelper.GetPos(m_Polar.context.center, m_Polar.context.outsideRadius, tooltipAngle, true);
|
||||||
|
|
||||||
switch (tooltip.type)
|
switch (tooltip.context.type)
|
||||||
{
|
{
|
||||||
case Tooltip.Type.Corss:
|
case Tooltip.Type.Corss:
|
||||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||||
|
|||||||
17
Runtime/Internal/Attributes/DefaultTooltipAttribute.cs
Normal file
17
Runtime/Internal/Attributes/DefaultTooltipAttribute.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace XCharts.Runtime
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
|
public sealed class DefaultTooltipAttribute : Attribute
|
||||||
|
{
|
||||||
|
public readonly Tooltip.Type type;
|
||||||
|
public readonly Tooltip.Trigger trigger;
|
||||||
|
|
||||||
|
public DefaultTooltipAttribute(Tooltip.Type type, Tooltip.Trigger trigger)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
this.trigger = trigger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Runtime/Internal/Attributes/DefaultTooltipAttribute.cs.meta
Normal file
11
Runtime/Internal/Attributes/DefaultTooltipAttribute.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a994dc47021bb4031ba6cf23eaf82e7e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -976,6 +976,15 @@ namespace XCharts.Runtime
|
|||||||
if (serie == null)
|
if (serie == null)
|
||||||
throw new ArgumentNullException("serie is null");
|
throw new ArgumentNullException("serie is null");
|
||||||
|
|
||||||
|
if (serie.GetType().IsDefined(typeof(DefaultTooltipAttribute), false))
|
||||||
|
{
|
||||||
|
var attribute1 = serie.GetType().GetAttribute<DefaultTooltipAttribute>();
|
||||||
|
if (attribute1 != null)
|
||||||
|
{
|
||||||
|
serie.context.tooltipTrigger = attribute1.trigger;
|
||||||
|
serie.context.tooltipType = attribute1.type;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!serie.GetType().IsDefined(typeof(SerieHandlerAttribute), false))
|
if (!serie.GetType().IsDefined(typeof(SerieHandlerAttribute), false))
|
||||||
{
|
{
|
||||||
Debug.LogError("Serie no Handler:" + serie.GetType());
|
Debug.LogError("Serie no Handler:" + serie.GetType());
|
||||||
|
|||||||
@@ -146,10 +146,9 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
RemoveAllChartComponent();
|
RemoveAllChartComponent();
|
||||||
OnBeforeSerialize();
|
OnBeforeSerialize();
|
||||||
AddChartComponentWhenNoExist<Title>();
|
EnsureChartComponent<Title>();
|
||||||
AddChartComponentWhenNoExist<Tooltip>();
|
EnsureChartComponent<Tooltip>();
|
||||||
|
EnsureChartComponent<Title>().text = GetType().Name;
|
||||||
GetChartComponent<Title>().text = GetType().Name;
|
|
||||||
|
|
||||||
if (m_Theme.sharedTheme != null)
|
if (m_Theme.sharedTheme != null)
|
||||||
m_Theme.sharedTheme.CopyTheme(ThemeType.Default);
|
m_Theme.sharedTheme.CopyTheme(ThemeType.Default);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XCharts.Runtime
|
|||||||
[SerieConvert(typeof(Line), typeof(Pie))]
|
[SerieConvert(typeof(Line), typeof(Pie))]
|
||||||
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
||||||
[DefaultAnimation(AnimationType.BottomToTop)]
|
[DefaultAnimation(AnimationType.BottomToTop)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
|
||||||
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataExtraField("m_Ignore")]
|
[SerieDataExtraField("m_Ignore")]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace XCharts.Runtime
|
|||||||
[SerieConvert(typeof(SimplifiedLine), typeof(Bar))]
|
[SerieConvert(typeof(SimplifiedLine), typeof(Bar))]
|
||||||
[CoordOptions(typeof(GridCoord))]
|
[CoordOptions(typeof(GridCoord))]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
|
||||||
[SerieComponent()]
|
[SerieComponent()]
|
||||||
[SerieDataComponent()]
|
[SerieDataComponent()]
|
||||||
[SerieDataExtraField()]
|
[SerieDataExtraField()]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[SerieHandler(typeof(CandlestickHandler), true)]
|
[SerieHandler(typeof(CandlestickHandler), true)]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
|
||||||
[SerieComponent()]
|
[SerieComponent()]
|
||||||
[SerieDataComponent(typeof(ItemStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieDataComponent(typeof(ItemStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataExtraField()]
|
[SerieDataExtraField()]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[SerieHandler(typeof(SimplifiedCandlestickHandler), true)]
|
[SerieHandler(typeof(SimplifiedCandlestickHandler), true)]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
|
||||||
[SerieComponent()]
|
[SerieComponent()]
|
||||||
[SerieDataComponent()]
|
[SerieDataComponent()]
|
||||||
[SerieDataExtraField()]
|
[SerieDataExtraField()]
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[SerieHandler(typeof(HeatmapHandler), true)]
|
[SerieHandler(typeof(HeatmapHandler), true)]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.None, Tooltip.Trigger.Axis)]
|
||||||
[RequireChartComponent(typeof(VisualMap))]
|
[RequireChartComponent(typeof(VisualMap))]
|
||||||
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
||||||
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
|
|||||||
@@ -7,22 +7,10 @@ namespace XCharts.Runtime
|
|||||||
[SerieConvert(typeof(Bar), typeof(Pie))]
|
[SerieConvert(typeof(Bar), typeof(Pie))]
|
||||||
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
[CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
[SerieComponent(
|
[DefaultTooltip(Tooltip.Type.Line, Tooltip.Trigger.Axis)]
|
||||||
typeof(LabelStyle),
|
|
||||||
typeof(EndLabelStyle),
|
|
||||||
typeof(LineArrow),
|
|
||||||
typeof(AreaStyle),
|
|
||||||
typeof(EmphasisStyle),
|
|
||||||
typeof(BlurStyle),
|
|
||||||
typeof(SelectStyle))]
|
|
||||||
[SerieDataComponent(
|
|
||||||
typeof(ItemStyle),
|
|
||||||
typeof(LabelStyle),
|
|
||||||
typeof(SerieSymbol),
|
|
||||||
typeof(EmphasisStyle),
|
|
||||||
typeof(BlurStyle),
|
|
||||||
typeof(SelectStyle))]
|
|
||||||
[SerieDataExtraField("m_State", "m_Ignore")]
|
[SerieDataExtraField("m_State", "m_Ignore")]
|
||||||
|
[SerieComponent(typeof(LabelStyle), typeof(EndLabelStyle), typeof(LineArrow), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
|
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(SerieSymbol), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
public class Line : Serie, INeedSerieContainer
|
public class Line : Serie, INeedSerieContainer
|
||||||
{
|
{
|
||||||
public int containerIndex { get; internal set; }
|
public int containerIndex { get; internal set; }
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace XCharts.Runtime
|
|||||||
[SerieConvert(typeof(SimplifiedBar), typeof(Line))]
|
[SerieConvert(typeof(SimplifiedBar), typeof(Line))]
|
||||||
[CoordOptions(typeof(GridCoord))]
|
[CoordOptions(typeof(GridCoord))]
|
||||||
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
[DefaultAnimation(AnimationType.LeftToRight, false)]
|
||||||
|
[DefaultTooltip(Tooltip.Type.Line, Tooltip.Trigger.Axis)]
|
||||||
[SerieComponent(typeof(AreaStyle))]
|
[SerieComponent(typeof(AreaStyle))]
|
||||||
[SerieDataComponent()]
|
[SerieDataComponent()]
|
||||||
[SerieDataExtraField()]
|
[SerieDataExtraField()]
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||||
{
|
{
|
||||||
chart.AddChartComponentWhenNoExist<RadarCoord>();
|
chart.EnsureChartComponent<RadarCoord>();
|
||||||
var serie = chart.AddSerie<Radar>(serieName);
|
var serie = chart.AddSerie<Radar>(serieName);
|
||||||
serie.symbol.show = true;
|
serie.symbol.show = true;
|
||||||
serie.symbol.type = SymbolType.Circle;
|
serie.symbol.type = SymbolType.Circle;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[SerieHandler(typeof(EffectScatterHandler), true)]
|
[SerieHandler(typeof(EffectScatterHandler), true)]
|
||||||
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
||||||
|
[DefaultTooltip(Tooltip.Type.None, Tooltip.Trigger.Item)]
|
||||||
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataExtraField("m_Radius")]
|
[SerieDataExtraField("m_Radius")]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
[SerieHandler(typeof(ScatterHandler), true)]
|
[SerieHandler(typeof(ScatterHandler), true)]
|
||||||
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
||||||
|
[DefaultTooltip(Tooltip.Type.None, Tooltip.Trigger.Item)]
|
||||||
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
[SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||||
[SerieDataExtraField("m_Radius")]
|
[SerieDataExtraField("m_Radius")]
|
||||||
|
|||||||
@@ -115,5 +115,8 @@ namespace XCharts.Runtime
|
|||||||
public List<PointInfo> drawPoints = new List<PointInfo>();
|
public List<PointInfo> drawPoints = new List<PointInfo>();
|
||||||
public SerieParams param = new SerieParams();
|
public SerieParams param = new SerieParams();
|
||||||
public ChartLabel titleObject { get; set; }
|
public ChartLabel titleObject { get; set; }
|
||||||
|
|
||||||
|
public Tooltip.Type tooltipType;
|
||||||
|
public Tooltip.Trigger tooltipTrigger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user