* UILineChartOption: 增加了GetDataPoint,可获取曲线上的数据值

This commit is contained in:
Sunny 2023-08-13 21:58:11 +08:00
parent afaec79519
commit b8999f3680
2 changed files with 29 additions and 1 deletions

View File

@ -21,6 +21,7 @@
* 2022-11-25: V3.2.2 线
* 2022-11-25: V3.2.2
* 2023-05-06: V3.3.6 UpdateYData函数Y轴值
* 2023-08-13: V3.4.1 GetDataPoint线
******************************************************************************/
using System;
@ -549,6 +550,13 @@ namespace Sunny.UI
public int DataCount => XData.Count;
public SeriesDataPoint GetDataPoint(int index)
{
if (DataCount == 0) return new SeriesDataPoint();
if (index >= 0 && index < XData.Count) return new SeriesDataPoint(this, XData[index], YData[index]);
return new SeriesDataPoint();
}
public UISeriesDataOrder Order = UISeriesDataOrder.X;
public bool GetNearestPoint(Point p, int offset, out double x, out double y, out int index)
@ -711,6 +719,26 @@ namespace Sunny.UI
Round
}
public struct SeriesDataPoint
{
public double X;
public double Y;
public UILineSeries Series { get; set; }
public SeriesDataPoint()
{
}
public SeriesDataPoint(UILineSeries series, double x, double y)
{
X = x;
Y = y;
Series = series;
}
}
public struct UILineSelectPoint
{
public int Index { get; set; }

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>net7.0-windows;net6.0-windows;net472;net40</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<LangVersion>11.0</LangVersion>
<ProjectGuid>{AB1CB247-E20B-4CBE-B269-570ADDD96C53}</ProjectGuid>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Sunny.UI</RootNamespace>