Skip to content

Commit

Permalink
fixed emphasis label
Browse files Browse the repository at this point in the history
  • Loading branch information
monitor1394 committed Dec 20, 2021
1 parent 76f640f commit f0e94d3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Assets/XCharts/CHANGELOG-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

## branch-2.0

* (2021.12.21) Fixed `Emphasis` dont work
* (2021.12.17) Fixed `MarkLine` does not auto refresh label active when serie hide #178
* (2021.12.10) Improved `Radar`'s `AxisLine` and `SplitLine` to be controlled separately
* (2021.12.08) Fixed y axis does not refresh when serie hidden
Expand Down
1 change: 1 addition & 0 deletions Assets/XCharts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

## branch-2.0

* (2021.12.21) 修复`Emphasis`不生效的问题
* (2021.12.17) 修复`MarkLine`在运行时`Label`不自动刷新显示隐藏的问题 #178
* (2021.12.10) 完善`Radar``AxisLine``SplitLine`可单独控制
* (2021.12.08) 修复`Serie`隐藏后`Y`轴最大值不刷新的问题
Expand Down
2 changes: 0 additions & 2 deletions Assets/XCharts/Runtime/Component/Sub/MarkLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ internal class MarkLineHandler : IComponentHandler
{
public CoordinateChart chart;
private GameObject m_MarkLineLabelRoot;
private bool m_RefreshLabel = false;

public MarkLineHandler(CoordinateChart chart)
{
Expand Down Expand Up @@ -515,7 +514,6 @@ private void DrawMakLineData(VertexHelper vh, MarkLineData data, SerieAnimation
data.runtimeCurrentEndPosition = ep;
if (sp != Vector3.zero || ep != Vector3.zero)
{
m_RefreshLabel = true;
chart.ClampInChart(ref sp);
chart.ClampInChart(ref ep);
var theme = chart.theme.axis;
Expand Down
8 changes: 8 additions & 0 deletions Assets/XCharts/Runtime/Helper/SerieHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ public static SerieLabel GetSerieLabel(Serie serie, SerieData serieData, bool hi
}
}

public static SerieLabel GetSerieEmphasisLabel(Serie serie, SerieData serieData)
{
if (!serie.IsPerformanceMode() && serieData.enableEmphasis && serieData.emphasis.show)
return serieData.emphasis.label;
else if (serie.emphasis.show) return serie.emphasis.label;
else return null;
}

public static IconStyle GetIconStyle(Serie serie, SerieData serieData)
{
if (serieData.enableIconStyle) return serieData.iconStyle;
Expand Down
3 changes: 2 additions & 1 deletion Assets/XCharts/Runtime/Internal/BaseChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,10 @@ protected void AddSerieLabel(Serie serie, SerieData serieData, ref int count)
if (m_SerieLabelRoot == null) return;
if (count == -1) count = serie.dataCount;
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
var serieEmphasisLable = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
if (serie.IsPerformanceMode()) return;
if (!serieLabel.show && !iconStyle.show) return;
if (!serieLabel.show && (serieEmphasisLable == null || !serieEmphasisLable.show) && !iconStyle.show) return;
if (serie.animation.enable && serie.animation.HasFadeOut()) return;
var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
var color = Color.grey;
Expand Down

0 comments on commit f0e94d3

Please sign in to comment.