mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加Settings中关于关于材质球设置的参数 #140
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
|
||||
## Latest
|
||||
|
||||
* (2021.05.01) Added `Settings` parameters for painter's material #140
|
||||
* (2021.05.01) Fixed an issue where some super large or super small values could not be properly represented
|
||||
* (2021.04.29) Fixed an issue with `Radar` switching to `Circle` anomaly #139
|
||||
* (2021.04.29) Added `Settings`'s `reversePainter` to set whether or not `Serie` is drawn in reverse order
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
## Latest
|
||||
|
||||
* (2021.05.01) 增加`Settings`中关于关于材质球设置的参数 #140
|
||||
* (2021.05.01) 修复无法正确表示部分超大或超小数值的问题
|
||||
* (2021.04.29) 修复`Radar`切换到`Circle`异常的问题 #139
|
||||
* (2021.04.29) 增加`Settings`的`reversePainter`可设置`Serie`的绘制是否逆序
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
* `BaseChart.IsInChart(Vector2 local)`:坐标是否在图表范围内。
|
||||
* `BaseChart.IsInChart(float x, float y)`:坐标是否在图表范围内。
|
||||
* `BaseChart.EnableBackground(bool flag)`:开启背景组件。背景组件在`chart`受上层布局控制时无法开启。
|
||||
* `BaseChart.SetBasePainterMaterial(Material material)`:设置Base Painter的材质球。
|
||||
* `BaseChart.SetSeriePainterMaterial(Material material)`:设置Serie Painter的材质球。
|
||||
* `BaseChart.SetTopPainterMaterial(Material material)`:设置Top Painter的材质球。
|
||||
|
||||
## `CoordinateChart`
|
||||
|
||||
|
||||
@@ -799,6 +799,9 @@ K线图系列。
|
||||
|
||||
* `reversePainter`:Painter是否逆序。逆序时index大的serie最先绘制。
|
||||
* `maxPainter`:默认最大Painter数据,当Serie数量大于maxPainter时会平均分配Painter。
|
||||
* `basePainterMaterial`:Base Pointer 材质球,设置后会影响Axis等。
|
||||
* `seriePainterMaterial`:Serie Pointer 材质球,设置后会影响所有Serie。
|
||||
* `topPainterMaterial`:Top Pointer 材质球,设置后会影响Tooltip等。
|
||||
* `lineSmoothStyle`:曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
|
||||
* `lineSmoothness`:曲线平滑度。值越小曲线越平滑,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
|
||||
* `lineSegmentDistance`: 线段的分割距离。普通折线图的线是由很多线段组成,段数由该数值决定。值越小段数越多,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
* `BaseChart.IsInChart(Vector2 local)`:坐标是否在图表范围内。
|
||||
* `BaseChart.IsInChart(float x, float y)`:坐标是否在图表范围内。
|
||||
* `BaseChart.EnableBackground(bool flag)`:开启背景组件。背景组件在`chart`受上层布局控制时无法开启。
|
||||
* `BaseChart.SetBasePainterMaterial(Material material)`:设置Base Painter的材质球。
|
||||
* `BaseChart.SetSeriePainterMaterial(Material material)`:设置Serie Painter的材质球。
|
||||
* `BaseChart.SetTopPainterMaterial(Material material)`:设置Top Painter的材质球。
|
||||
|
||||
## `CoordinateChart`
|
||||
|
||||
|
||||
@@ -692,6 +692,9 @@ K线图系列。
|
||||
|
||||
* `reversePainter`:Painter是否逆序。逆序时index大的serie最先绘制。
|
||||
* `maxPainter`:默认最大Painter数据,当Serie数量大于maxPainter时会平均分配Painter。
|
||||
* `basePainterMaterial`:Base Pointer 材质球,设置后会影响Axis等。
|
||||
* `seriePainterMaterial`:Serie Pointer 材质球,设置后会影响所有Serie。
|
||||
* `topPainterMaterial`:Top Pointer 材质球,设置后会影响Tooltip等。
|
||||
* `lineSmoothStyle`: 曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
|
||||
* `lineSmoothness`: 曲线平滑度。值越小曲线越平滑,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
|
||||
* `lineSegmentDistance`: 线段的分割距离。普通折线图的线是由很多线段组成,段数由该数值决定。值越小段数越多,但顶点数也会随之增加。当开启有渐变的区域填充时,数值越大渐变过渡效果越差。
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace XCharts
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_ReversePainter");
|
||||
PropertyField(prop, "m_MaxPainter");
|
||||
PropertyField(prop, "m_BasePainterMaterial");
|
||||
PropertyField(prop, "m_SeriePainterMaterial");
|
||||
PropertyField(prop, "m_TopPainterMaterial");
|
||||
PropertyField(prop, "m_LineSmoothStyle");
|
||||
PropertyField(prop, "m_LineSmoothness");
|
||||
PropertyField(prop, "m_LineSegmentDistance");
|
||||
|
||||
@@ -743,5 +743,45 @@ namespace XCharts
|
||||
public virtual void InitCustomSerieTooltip(ref StringBuilder stringBuilder, Serie serie, int index)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置Base Painter的材质球
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
public void SetBasePainterMaterial(Material material)
|
||||
{
|
||||
settings.basePainterMaterial = material;
|
||||
if (m_Painter != null)
|
||||
{
|
||||
m_Painter.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置Serie Painter的材质球
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
public void SetSeriePainterMaterial(Material material)
|
||||
{
|
||||
settings.basePainterMaterial = material;
|
||||
if (m_PainterList != null)
|
||||
{
|
||||
foreach (var painter in m_PainterList)
|
||||
painter.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置Top Painter的材质球
|
||||
/// </summary>
|
||||
/// <param name="material"></param>
|
||||
public void SetTopPainterMaterial(Material material)
|
||||
{
|
||||
settings.topPainterMaterial = material;
|
||||
if (m_PainterTop != null)
|
||||
{
|
||||
m_PainterTop.material = material;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace XCharts
|
||||
{
|
||||
[SerializeField] [Range(1, 20)] protected int m_MaxPainter = 10;
|
||||
[SerializeField] protected bool m_ReversePainter = false;
|
||||
[SerializeField] protected Material m_BasePainterMaterial;
|
||||
[SerializeField] protected Material m_SeriePainterMaterial;
|
||||
[SerializeField] protected Material m_TopPainterMaterial;
|
||||
[SerializeField] [Range(1, 10)] protected float m_LineSmoothStyle = 3f;
|
||||
[SerializeField] [Range(1f, 20)] protected float m_LineSmoothness = 2f;
|
||||
[SerializeField] [Range(1f, 20)] protected float m_LineSegmentDistance = 3f;
|
||||
@@ -44,6 +47,30 @@ namespace XCharts
|
||||
set { if (PropertyUtil.SetStruct(ref m_ReversePainter, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Base Pointer 材质球,设置后会影响Axis等。
|
||||
/// </summary>
|
||||
public Material basePainterMaterial
|
||||
{
|
||||
get { return m_BasePainterMaterial; }
|
||||
set { if (PropertyUtil.SetClass(ref m_BasePainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Serie Pointer 材质球,设置后会影响所有Serie。
|
||||
/// </summary>
|
||||
public Material seriePainterMaterial
|
||||
{
|
||||
get { return m_SeriePainterMaterial; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SeriePainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Top Pointer 材质球,设置后会影响Tooltip等。
|
||||
/// </summary>
|
||||
public Material topPainterMaterial
|
||||
{
|
||||
get { return m_TopPainterMaterial; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TopPainterMaterial, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Curve smoothing factor. By adjusting the smoothing coefficient, the curvature of the curve can be changed,
|
||||
/// and different curves with slightly different appearance can be obtained.
|
||||
/// 曲线平滑系数。通过调整平滑系数可以改变曲线的曲率,得到外观稍微有变化的不同曲线。
|
||||
@@ -110,6 +137,9 @@ namespace XCharts
|
||||
{
|
||||
m_ReversePainter = settings.reversePainter;
|
||||
m_MaxPainter = settings.maxPainter;
|
||||
m_BasePainterMaterial = settings.basePainterMaterial;
|
||||
m_SeriePainterMaterial = settings.seriePainterMaterial;
|
||||
m_TopPainterMaterial = settings.topPainterMaterial;
|
||||
m_LineSmoothStyle = settings.lineSmoothStyle;
|
||||
m_LineSmoothness = settings.lineSmoothness;
|
||||
m_LineSegmentDistance = settings.lineSegmentDistance;
|
||||
|
||||
@@ -316,6 +316,7 @@ namespace XCharts
|
||||
protected override void InitPainter()
|
||||
{
|
||||
base.InitPainter();
|
||||
m_Painter.material = settings.basePainterMaterial;
|
||||
m_PainterList.Clear();
|
||||
if (settings == null) return;
|
||||
var sizeDelta = new Vector2(m_GraphWidth, m_GraphHeight);
|
||||
@@ -328,6 +329,7 @@ namespace XCharts
|
||||
painter.type = Painter.Type.Serie;
|
||||
painter.onPopulateMesh = OnDrawPainterSerie;
|
||||
painter.SetActive(false, m_DebugMode);
|
||||
painter.material = settings.seriePainterMaterial;
|
||||
m_PainterList.Add(painter);
|
||||
}
|
||||
m_PainterTop = ChartHelper.AddPainterObject("painter_t", transform, m_GraphMinAnchor,
|
||||
@@ -335,6 +337,7 @@ namespace XCharts
|
||||
m_PainterTop.type = Painter.Type.Top;
|
||||
m_PainterTop.onPopulateMesh = OnDrawPainterTop;
|
||||
m_PainterTop.SetActive(true, m_DebugMode);
|
||||
m_PainterTop.material = settings.topPainterMaterial;
|
||||
}
|
||||
|
||||
private void InitTitles()
|
||||
|
||||
Reference in New Issue
Block a user