/// <summary> /// Отрисовка траектории движения частицы /// </summary> /// <param name="args">Параметры модели</param> /// <returns>Путь к html-файлу с графиком движения частицы</returns> public static string BuildPlot(TrajectoryCalculatorArgs args) { var points = TrajectoryCalculator.Calculate(args); var plot = new Plot ( Plot.traces ( Traces.scatter3d ( Scatter3d.x(GetCoordinates(points, point => point.X)), Scatter3d.y(GetCoordinates(points, point => point.Y)), Scatter3d.z(GetCoordinates(points, point => point.Z)), Scatter3d.mode(Scatter3d.Mode.lines()) ) ), Plot.layout ( Layout.autosize(true), Layout.margin ( Margin.l(0), Margin.t(0), Margin.r(0), Margin.b(0) ), Layout.scene ( Scene.Aspectmode.data() ) ) ); var plotFileName = "plot.html"; File.WriteAllText ( plotFileName, plot .Render() .ToString() .Replace("<body>", "<body style=\"overflow: hidden\">") .Replace("height: 100%", "height: 100vh;") .Replace("https://cdn.plot.ly/plotly-latest.min.js", "plotly.js") ); return(plotFileName); }
private void _Add(params Box <Types.IScatter3dProperty>[] properties) { var trace = Traces.scatter3d(properties); _Traces.Add(trace); }