开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
forked from anysharp/oxyplot
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (12)
标签 (7)
master
develop
release/v2.2.0
codestyle
skiaupdate
release/v2.1.2
snyk-fix-9fd1aceadf2111de25175cc5fcecf926
release/v2.1.0
release/v2.1.0-Preview1
StemSeriesActualMarker
release/v2.0.0
release/v1.0.0
v2.2.0
v2.1.2
v2.1.0
v2.0.0
v1.0.0
v0.0.1
v0.20141546
master
分支 (12)
标签 (7)
master
develop
release/v2.2.0
codestyle
skiaupdate
release/v2.1.2
snyk-fix-9fd1aceadf2111de25175cc5fcecf926
release/v2.1.0
release/v2.1.0-Preview1
StemSeriesActualMarker
release/v2.0.0
release/v1.0.0
v2.2.0
v2.1.2
v2.1.0
v2.0.0
v1.0.0
v0.0.1
v0.20141546
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (12)
标签 (7)
master
develop
release/v2.2.0
codestyle
skiaupdate
release/v2.1.2
snyk-fix-9fd1aceadf2111de25175cc5fcecf926
release/v2.1.0
release/v2.1.0-Preview1
StemSeriesActualMarker
release/v2.0.0
release/v1.0.0
v2.2.0
v2.1.2
v2.1.0
v2.0.0
v1.0.0
v0.0.1
v0.20141546
oxyplot
/
Source
/
Examples
/
ExampleLibrary
/
Series
/
FunctionSeriesExamples.cs
oxyplot
/
Source
/
Examples
/
ExampleLibrary
/
Series
/
FunctionSeriesExamples.cs
FunctionSeriesExamples.cs 12.47 KB
一键复制 编辑 原始数据 按行查看 历史
jonathan.arweck 提交于 2019年09月04日 18:21 +08:00 . Add Support for transposed XYAxisSeries (#1334)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FunctionSeriesExamples.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace ExampleLibrary
{
using System;
using ExampleLibrary.Utilities;
using OxyPlot;
using OxyPlot.Annotations;
using OxyPlot.Axes;
using OxyPlot.Series;
[Examples("FunctionSeries"), Tags("Series")]
public class FunctionSeriesExamples
{
[Example("Square wave")]
public static PlotModel SquareWave()
{
return CreateSquareWave(25);
}
[Example("Square wave (transposed)")]
public static PlotModel SquareWaveTransposed()
{
return SquareWave().Transpose();
}
private static PlotModel CreateSquareWave(int n = 25)
{
var plot = new PlotModel { Title = "Square wave (Gibbs phenomenon)" };
Func<double, double> f = (x) =>
{
double y = 0;
for (int i = 0; i < n; i++)
{
int j = i * 2 + 1;
y += Math.Sin(j * x) / j;
}
return y;
};
var fs = new FunctionSeries(f, -10, 10, 0.0001, "sin(x)+sin(3x)/3+sin(5x)/5+...+sin(" + (2 * n - 1) + ")/" + (2 * n - 1));
plot.Series.Add(fs);
plot.Subtitle = "n = " + fs.Points.Count;
plot.Axes.Add(new LinearAxis
{
Position = AxisPosition.Left,
Minimum = -4,
Maximum = 4
});
plot.Axes.Add(new LinearAxis
{
Position = AxisPosition.Bottom
});
return plot;
}
[Example("Parametric function 1")]
public static PlotModel Clover()
{
return CreateParametricPlot(
t => 2 * Math.Cos(2 * t) * Math.Cos(t),
t => 2 * Math.Cos(2 * t) * Math.Sin(t),
// t=>-4*Math.Sin(2*t)*Math.Cos(t)-2*Math.Cos(2*t)*Math.Sin(t),
// t=>-4*Math.Sin(2*t)*Math.Sin(t)+2*Math.Cos(2*t)*Math.Cos(t),))))
0, Math.PI * 2, 1000,
"Parametric function",
"Using the CartesianAxes property",
"2cos(2t)cos(t) , 2cos(2t)sin(t)");
}
[Example("Parametric function 2")]
public static PlotModel ParametricFunction2()
{
return CreateParametricPlot(
t => 3 * Math.Sin(5 * t),
t => 3 * Math.Cos(3 * t),
0, Math.PI * 2, 1000,
"Parametric function",
null,
"3sin(5t) , 3cos(3t)");
}
[Example("Parametric function 3")]
public static PlotModel ParametricFunction3()
{
return CreateParametricPlot(
t => 2 * Math.Cos(t) + Math.Cos(8 * t),
t => 2 * Math.Sin(t) + Math.Sin(8 * t),
0, Math.PI * 2, 1000,
"Parametric function",
null,
"2cos(t)+cos(8t) , 2sin(t)+sin(8t)");
}
[Example("Lemniscate of Bernoulli")]
public static PlotModel LemniscateOfBernoulli()
{
// http://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli
double a = 1;
return CreateParametricPlot(
t => a * Math.Sqrt(2) * Math.Cos(t) / (Math.Sin(t) * Math.Sin(t) + 1),
t => a * Math.Sqrt(2) * Math.Cos(t) * Math.Sin(t) / (Math.Sin(t) * Math.Sin(t) + 1),
0, Math.PI * 2, 1000, "Lemniscate of Bernoulli");
}
[Example("Lemniscate of Gerono")]
public static PlotModel LemniscateOfGerono()
{
// http://en.wikipedia.org/wiki/Lemniscate_of_Gerono
return CreateParametricPlot(t => Math.Cos(t), t => Math.Sin(2 * t) / 2, 0, Math.PI * 2, 1000, "Lemniscate of Gerono");
}
[Example("Lissajous figure")]
public static PlotModel LissajousFigure()
{
double a = 3;
double b = 2;
double delta = Math.PI / 2;
// http://en.wikipedia.org/wiki/Lissajous_figure
return CreateParametricPlot(t => Math.Sin(a * t + delta), t => Math.Sin(b * t), 0, Math.PI * 2, 1000, "Lissajous figure", null, "a=3, b=2, δ = π/2");
}
[Example("Rose curve")]
public static PlotModel RoseCurve()
{
// http://en.wikipedia.org/wiki/Rose_curve
var m = new PlotModel
{
Title = "Rose curve",
PlotType = PlotType.Polar,
PlotAreaBorderThickness = new OxyThickness(0)
};
m.Axes.Add(new AngleAxis
{
Minimum = 0,
Maximum = Math.PI * 2,
MajorStep = Math.PI / 4,
MinorStep = Math.PI / 16,
MajorGridlineStyle = LineStyle.Solid,
FormatAsFractions = true,
FractionUnit = Math.PI,
FractionUnitSymbol = "π"
});
m.Axes.Add(new MagnitudeAxis() { MajorGridlineStyle = LineStyle.Solid });
int d = 4;
int n = 3;
double k = (double)n / d;
m.Series.Add(new FunctionSeries(t => Math.Sin(k * t), t => t, 0, Math.PI * 2 * d, 1000, string.Format("d={0}, n={1}", d, n)));
return m;
}
[Example("Limaçon of Pascal")]
public static PlotModel LimaconOfPascal()
{
// http://en.wikipedia.org/wiki/Lima%C3%A7on
var m = new PlotModel { Title = "Limaçon of Pascal", PlotType = PlotType.Cartesian };
for (int a = 4; a <= 4; a++)
for (int b = 0; b <= 10; b++)
{
m.Series.Add(
new FunctionSeries(
t => a / 2 + b * Math.Cos(t) + a / 2 * Math.Cos(2 * t),
t => b * Math.Sin(t) + a / 2 * Math.Sin(2 * t),
0,
Math.PI * 2,
1000,
string.Format("a={0}, b={1}", a, b)));
}
return m;
}
[Example("Folium of Descartes")]
public static PlotModel DescartesFolium()
{
// http://www.wolframalpha.com/input/?i=folium+of+Descartes
var m = new PlotModel { Title = "Folium of Descartes", PlotType = PlotType.Cartesian };
m.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -3, Maximum = 3 });
m.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Minimum = -3, Maximum = 3 });
double a = 1;
m.Series.Add(new FunctionSeries(t => 3 * a * t / (t * t * t + 1), t => 3 * a * t * t / (t * t * t + 1), -30, 30, 1001, string.Format("a={0}", a)));
return m;
}
[Example("Trisectrix of Maclaurin")]
public static PlotModel TrisectrixOfMaclaurin()
{
// http://en.wikipedia.org/wiki/Trisectrix_of_Maclaurin
// http://mathworld.wolfram.com/MaclaurinTrisectrix.html
var m = new PlotModel { Title = "Trisectrix of Maclaurin", PlotType = PlotType.Cartesian };
double a = 1;
m.Series.Add(new FunctionSeries(t => a * (t * t - 3) / (t * t + 1), t => a * t * (t * t - 3) / (t * t + 1), -5, 5, 1000));
return m;
}
[Example("Fermat's spiral")]
public static PlotModel FermatsSpiral()
{
// http://en.wikipedia.org/wiki/Fermat's_spiral
// http://www.wolframalpha.com/input/?i=Fermat%27s+spiral
var m = new PlotModel { Title = "Fermat's spiral", PlotType = PlotType.Cartesian };
double a = 1;
m.Series.Add(new FunctionSeries(t => a * Math.Sqrt(t) * Math.Cos(t), t => a * Math.Sqrt(t) * Math.Sin(t), 0, 20, 1000));
m.Series.Add(new FunctionSeries(t => -a * Math.Sqrt(t) * Math.Cos(t), t => -a * Math.Sqrt(t) * Math.Sin(t), 0, 20, 1000));
return m;
}
[Example("Fish curve")]
public static PlotModel FishCurve()
{
// http://www.wolframalpha.com/input/?i=fish+curve
var m = new PlotModel { Title = "Fish curve", PlotType = PlotType.Cartesian };
for (double a = 0.1; a < 1; a += 0.1)
{
m.Series.Add(new FunctionSeries(t => a * (Math.Cos(t) - Math.Sin(t) * Math.Sin(t) / Math.Sqrt(2)), t => a * Math.Cos(t) * Math.Sin(t), 0, 2 * Math.PI, 1000));
}
return m;
}
[Example("Heaviside step function")]
public static PlotModel HeavisideStepFunction()
{
// http://en.wikipedia.org/wiki/Heaviside_step_function
var m = new PlotModel { Title = "Heaviside step function", PlotType = PlotType.Cartesian };
m.Series.Add(new FunctionSeries(x =>
{
// make a gap in the curve at x=0
if (Math.Abs(x) < 1e-8) return double.NaN;
return x < 0 ? 0 : 1;
}, -2, 2, 0.001));
m.Annotations.Add(new LineAnnotation { Type = LineAnnotationType.Vertical, Color = m.DefaultColors[0], X = 0, MinimumY = 0, MaximumY = 1 });
return m;
}
[Example("FunctionSeries")]
public static PlotModel FunctionSeries()
{
var pm = new PlotModel
{
Title = "Trigonometric functions",
Subtitle = "Example using the FunctionSeries",
PlotType = PlotType.Cartesian,
PlotAreaBackground = OxyColors.White
};
pm.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)"));
pm.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)"));
pm.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 1000, "cos(t),sin(t)"));
return pm;
}
[Example("Squirqle")]
public static PlotModel Squirqle()
{
var plot = new PlotModel { Title = "Squirqle", PlotType = PlotType.Cartesian };
plot.Series.Add(CreateSuperellipseSeries(4, 1, 1));
return plot;
}
[Example("Superellipse n=20")]
public static PlotModel Superellipse20()
{
var plot = new PlotModel { Title = "Superellipse", PlotType = PlotType.Cartesian };
var s = CreateSuperellipseSeries(20, 1, 1);
s.MarkerType = MarkerType.Circle;
plot.Series.Add(s);
return plot;
}
[Example("Lamé curves")]
public static PlotModel LameCurves()
{
var plot = new PlotModel { Title = "Lamé curves", PlotType = PlotType.Cartesian, LegendPlacement = LegendPlacement.Outside };
for (double n = 0.25; n < 2; n += 0.25)
{
plot.Series.Add(CreateSuperellipseSeries(n, 1, 1));
}
for (double n = 2; n <= 8 + 1e-6; n += 1)
{
plot.Series.Add(CreateSuperellipseSeries(n, 1, 1));
}
return plot;
}
public static FunctionSeries CreateSuperellipseSeries(double n, double a, double b)
{
// http://en.wikipedia.org/wiki/Superellipse
return new FunctionSeries(
t => a * Math.Sign(Math.Cos(t)) * Math.Pow(Math.Abs(Math.Cos(t)), 2 / n),
t => b * Math.Sign(Math.Sin(t)) * Math.Pow(Math.Abs(Math.Sin(t)), 2 / n),
0,
Math.PI * 2,
101,
string.Format("n={0}, a={1}, b={2}", n, a, b));
}
private static PlotModel CreateParametricPlot(Func<double, double> fx, Func<double, double> fy, double t0,
double t1, int n, string title, string subtitle = null,
string seriesTitle = null)
{
var plot = new PlotModel { Title = title, Subtitle = subtitle, PlotType = PlotType.Cartesian };
plot.Series.Add(new FunctionSeries(fx, fy, t0, t1, n, seriesTitle));
return plot;
}
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

OxyPlot 是一个用于数据可视化的类库,支持多种图表类型,包括折线图、柱状图和饼图等,并具有高度可定制化的特点。 支持跨平台开发,适用于 Windows、macOS 和 Linux,并且可以与多种 C# UI 框架(如 Windows Forms 和 WPF)无缝集成。 通过使用 OxyPlot可以轻松实现数据可视化功能,帮助用户更好地理解和分析数据。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tk-7/oxyplot.git
git@gitee.com:tk-7/oxyplot.git
tk-7
oxyplot
oxyplot
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /