Closed HajiyevEl closed 2 months ago
Well, i think indicator label with 'dynamic axis split number when zooming' problem solved. Changed some code in TooltipHandler.cs :
private void SetTooltipIndicatorLabel(Tooltip tooltip, Axis axis, ChartLabel label)
{
...
if (axis.IsCategory())
{
// Old
//var index = (int)axis.context.pointerValue;
//var category = axis.GetData(index);
//label.SetText(axis.indicatorLabel.GetFormatterContent(index, category));
// Edited
var index = (int)axis.context.pointerValue;
var dataZoom = chart.GetDataZoomOfAxis(axis);
var category = axis.GetData(index, dataZoom);
label.SetText(axis.indicatorLabel.GetFormatterContent(index, category));
}
...
}
![Screenshot 2024-04-12 163114](https://github.com/XCharts-Team/XCharts/assets/70325881/367654b6-25ef-44ac-8a10-b4c672de2b3d) ![Screenshot 2024-04-12 163148](https://github.com/XCharts-Team/XCharts/assets/70325881/1dc67c84-dd87-4140-b8e7-f3308309bd77)
But still, can't make Tooltip Indicator Labels show itself without turning on/off Tooltip component. Any ideas?
Also, it seems that Indicator labels and labels of axis cannot be disabled by just un-ticking active component, you must change at least some value inside component (for example sprite color) from default to custom, otherwise enabling/disabling component will not do anything. Tested on 'background' settings of indicatorLabel of axis.
Hi again! Same problem: can't make Tooltip Indicator Labels show itself without turning off/on Tooltip component in inspector. Please check this.
My Tooltip is set to Corss.
![Screenshot 2024-04-27 130130](https://github.com/XCharts-Team/XCharts/assets/70325881/688ea626-34ca-49eb-aeeb-7134dacdc6a1)
When tooltip component is initialized, Tooltip type becomes 'Line', and updates to Corss only later. Also, 'm_LabelRoot' object is setting itself via 'ChartHelper.AddObject', but somewhere before code reaches 'UpdateTooltipIndicatorLabelText' - 'm_LabelRoot' again becomes null.
![Screenshot 2024-04-27 125100](https://github.com/XCharts-Team/XCharts/assets/70325881/52bdddcd-d951-43e0-bae6-bb9566147e87) ![Screenshot 2024-04-27 125750](https://github.com/XCharts-Team/XCharts/assets/70325881/930a6c23-0e3f-4f2f-8990-3e0cf04a68fe) ![Screenshot 2024-04-27 130018](https://github.com/XCharts-Team/XCharts/assets/70325881/778c8f3d-2b11-4050-87af-5193d99ab0f3)
I ended up adding label object manually. Even tho it's spaghetti code, tooltip indicator labels is shown without need for turning on/off Tooltip component in inspector. Can you please check in-depth about what causes this issue?
@monitor1394
Hi again! Same problem: can't make Tooltip Indicator Labels show itself without turning off/on Tooltip component in inspector. Please check this.
My Tooltip is set to Corss.
Tooltip Settings
When tooltip component is initialized, Tooltip type becomes 'Line', and updates to Corss only later. Also, 'm_LabelRoot' object is setting itself via 'ChartHelper.AddObject', but somewhere before code reaches 'UpdateTooltipIndicatorLabelText' - 'm_LabelRoot' again becomes null.
Screenshots
![]()
![]()
I ended up adding label object manually. Even tho it's spaghetti code, tooltip indicator labels is shown without need for turning on/off Tooltip component in inspector. Can you please check in-depth about what causes this issue?
@monitor1394
I'm unable to replicate the issue you've described. Could you please provide detailed steps to reproduce it? Additionally, I attempted to set the type to 'Cross' both before and after execution, and in both cases, the operation performed normally.
I'm unable to replicate the issue you've described. Could you please provide detailed steps to reproduce it? Additionally, I attempted to set the type to 'Cross' both before and after execution, and in both cases, the operation performed normally.
You should try to instantiate prefab containing chart, because when i tried to replicate issue for you, i found out that even tho examples work fine, when i try to pack example script into prefab and instantiate it later, this issue with 'labels not showing' comes up (it seems that indicator line style color and other components will not be set properly either). So, it seems that if chart script exists in scene before play mode - all work as intended, but if you instantiate it later at runtime - issue comes up. Also, even tho i disabled/enabled Tooltip component in steps to replicate below, actually, disabling/enabling any of most of components will force labels to update (e.g. serie, axis, etc..)
I'm using XCharts version 3.10.2 in my project, but same issue exists in demo project.
Steps to replicate:
The issue has been fixed in version 3.11.0.
I think something is wrong with 'AxisHandler.UpdatePointerValue()' or pointer value does not get updated after i manually change axis split number, depending on xDataZoom current data quantity.
Screenshot
![Screenshot 2024-04-11 195915](https://github.com/XCharts-Team/XCharts/assets/70325881/0928b590-7b1c-4931-87dd-f130a309e9db)
Also, please help me understand behaviour of indicator labels on axises when tooltip is set to Corss mode.
Problem is, when tooltip in Corss mode, indicator labels are hidden, even thought they are enabled on axises.
Indicator Labels Hidden (Play-mode)
![Screenshot 2024-04-12 115031](https://github.com/XCharts-Team/XCharts/assets/70325881/a2130c2b-2d61-4e1f-9f44-74121252dbe4) ![Screenshot 2024-04-12 114930](https://github.com/XCharts-Team/XCharts/assets/70325881/8366f18c-a23d-4ef6-8bf2-a48238a92e1e) ![Screenshot 2024-04-12 120512](https://github.com/XCharts-Team/XCharts/assets/70325881/ba0dcdf7-99c0-433a-9efd-317f7e618a6c)
But if i disable and than enable Tooltip (Play-mode), they are shown and cannot be disabled.
Indicator Shown (Play-mode)
![Screenshot 2024-04-12 120557](https://github.com/XCharts-Team/XCharts/assets/70325881/24767543-6c18-4c0e-ab95-661e7016f832) ![Screenshot 2024-04-12 120643](https://github.com/XCharts-Team/XCharts/assets/70325881/fea1c89f-54ba-444a-aeec-5a5e87cabf16) ![Screenshot 2024-04-12 120759](https://github.com/XCharts-Team/XCharts/assets/70325881/3484a958-620f-40a9-b32c-32660af7b047)
Somehow, when indicator labels shown/or hidden - enabling/or disabling Indicator labels (Play-mode) on axises does not change their active state. Is it intended? By the way, i downloaded Demo project, and seen there same behavior in candlestick charts. If you enable/disable tooltip component (Play-mode), indicator labels are shown and cannot be disabled.
@monitor1394