* UILineChart: 增加图线隐藏
This commit is contained in:
parent
24cc20ac6c
commit
0e301a55af
Binary file not shown.
Binary file not shown.
4
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
4
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
@ -19,7 +19,7 @@ namespace Sunny.UI.Demo.Properties {
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
@ -271,7 +271,7 @@ namespace Sunny.UI.Demo.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 20220207 的本地化字符串。
|
||||
/// 查找类似 20220209 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string BuildDate {
|
||||
get {
|
||||
|
@ -155,7 +155,7 @@
|
||||
<value>..\Resources\brescia.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="BuildDate" xml:space="preserve">
|
||||
<value>20220207</value>
|
||||
<value>20220209</value>
|
||||
</data>
|
||||
<data name="ChartDarkStyle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ChartDarkStyle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
|
@ -30,6 +30,7 @@
|
||||
* 2021-12-31: V3.0.9 X轴支持字符串显示
|
||||
* 2022-01-06: V3.1.0 支持FillColor透明
|
||||
* 2022-01-09: V3.1.0 双坐标轴支持选区域缩放
|
||||
* 2022-02-09: V3.1.0 增加图线隐藏
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -427,7 +428,7 @@ namespace Sunny.UI
|
||||
|
||||
protected virtual void DrawSeries(Graphics g, Color color, UILineSeries series)
|
||||
{
|
||||
if (series.Points.Count == 0)
|
||||
if (series.Points.Count == 0 || !series.Visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -588,6 +589,8 @@ namespace Sunny.UI
|
||||
{
|
||||
foreach (var series in Option.Series.Values)
|
||||
{
|
||||
if (series.Points.Count == 0 || !series.Visible) continue;
|
||||
|
||||
Color color = series.Color;
|
||||
if (series.SymbolColor.IsValid()) color = series.SymbolColor;
|
||||
|
||||
@ -775,6 +778,7 @@ namespace Sunny.UI
|
||||
foreach (var series in Option.Series.Values)
|
||||
{
|
||||
if (series.DataCount == 0) continue;
|
||||
if (!series.Visible) continue;
|
||||
if (series.GetNearestPoint(e.Location, 4, out double x, out double y, out int index))
|
||||
{
|
||||
UILineSelectPoint point = new UILineSelectPoint();
|
||||
|
@ -69,83 +69,59 @@ namespace Sunny.UI
|
||||
return series;
|
||||
}
|
||||
|
||||
public UILineSeries AddSeries(string name, bool isY2 = false)
|
||||
public UILineSeries AddSeries(string seriesName, bool isY2 = false)
|
||||
{
|
||||
if (name.IsNullOrEmpty()) return null;
|
||||
UILineSeries series = new UILineSeries(name, isY2);
|
||||
if (seriesName.IsNullOrEmpty()) return null;
|
||||
UILineSeries series = new UILineSeries(seriesName, isY2);
|
||||
AddSeries(series);
|
||||
return series;
|
||||
}
|
||||
|
||||
public void AddData(string name, double x, double y)
|
||||
public void AddData(string seriesName, double x, double y)
|
||||
{
|
||||
if (!Series.ContainsKey(name)) return;
|
||||
Series[name].Add(x, y);
|
||||
if (!Series.ContainsKey(seriesName)) return;
|
||||
Series[seriesName].Add(x, y);
|
||||
}
|
||||
|
||||
public void AddData(string name, DateTime x, double y)
|
||||
public void AddData(string seriesName, DateTime x, double y)
|
||||
{
|
||||
if (!Series.ContainsKey(name)) return;
|
||||
Series[name].Add(x, y);
|
||||
if (!Series.ContainsKey(seriesName)) return;
|
||||
Series[seriesName].Add(x, y);
|
||||
}
|
||||
|
||||
public void AddData(string name, string x, double y)
|
||||
{
|
||||
if (!Series.ContainsKey(name)) return;
|
||||
Series[name].Add(x, y);
|
||||
}
|
||||
|
||||
public void AddData(string name, List<double> x, List<double> y)
|
||||
public void AddData(string seriesName, List<double> x, List<double> y)
|
||||
{
|
||||
if (x.Count != y.Count) return;
|
||||
for (int i = 0; i < x.Count; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
AddData(seriesName, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name, List<DateTime> x, List<double> y)
|
||||
public void AddData(string seriesName, List<DateTime> x, List<double> y)
|
||||
{
|
||||
if (x.Count != y.Count) return;
|
||||
for (int i = 0; i < x.Count; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
AddData(seriesName, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name, List<string> x, List<double> y)
|
||||
{
|
||||
if (x.Count != y.Count) return;
|
||||
for (int i = 0; i < x.Count; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name, double[] x, double[] y)
|
||||
public void AddData(string seriesName, double[] x, double[] y)
|
||||
{
|
||||
if (x.Length != y.Length) return;
|
||||
for (int i = 0; i < x.Length; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
AddData(seriesName, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name, DateTime[] x, double[] y)
|
||||
public void AddData(string seriesName, DateTime[] x, double[] y)
|
||||
{
|
||||
if (x.Length != y.Length) return;
|
||||
for (int i = 0; i < x.Length; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddData(string name, string[] x, double[] y)
|
||||
{
|
||||
if (x.Length != y.Length) return;
|
||||
for (int i = 0; i < x.Length; i++)
|
||||
{
|
||||
AddData(name, x[i], y[i]);
|
||||
AddData(seriesName, x[i], y[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,11 +135,11 @@ namespace Sunny.UI
|
||||
Series.Clear();
|
||||
}
|
||||
|
||||
public void Clear(string name)
|
||||
public void Clear(string seriesName)
|
||||
{
|
||||
if (Series.ContainsKey(name))
|
||||
if (Series.ContainsKey(seriesName))
|
||||
{
|
||||
Series[name].Clear();
|
||||
Series[seriesName].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,6 +304,8 @@ namespace Sunny.UI
|
||||
|
||||
public bool IsY2 { get; private set; }
|
||||
|
||||
public bool Visible { get; set; } = true;
|
||||
|
||||
public UILineSeries(string name, bool isY2 = false)
|
||||
{
|
||||
Name = name;
|
||||
|
@ -328,10 +328,6 @@ namespace Sunny.UI
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
if (Width <= 0 || Height <= 0) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user