{"id":1596,"date":"2022-10-26T04:15:47","date_gmt":"2022-10-26T11:15:47","guid":{"rendered":"https:\/\/gantovnik.com\/bio-tips\/?p=1596"},"modified":"2022-10-26T04:15:47","modified_gmt":"2022-10-26T11:15:47","slug":"210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4","status":"publish","type":"post","link":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4\/","title":{"rendered":"#305 Line plot using C#"},"content":{"rendered":"<p>Temperature.cs<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace WindowsFormsApp1\r\n{\r\n    public class Temperature\r\n    {\r\n        public string Location { get; set; }\r\n        public decimal M1 { get; set; }\r\n        public decimal M2 { get; set; }\r\n        public decimal M3 { get; set; }\r\n        public decimal M4 { get; set; }\r\n        public decimal M5 { get; set; }\r\n        public decimal M6 { get; set; }\r\n        public decimal M7 { get; set; }\r\n        public decimal M8 { get; set; }\r\n        public decimal M9 { get; set; }\r\n        public decimal M10 { get; set; }\r\n        public decimal M11 { get; set; }\r\n        public decimal M12 { get; set; }\r\n\r\n        public object this&#x5B;string propertyName]\r\n        {\r\n            get { return this.GetType().GetProperty(propertyName).GetValue(this, null); }\r\n            set { this.GetType().GetProperty(propertyName).SetValue(this, value, null); }\r\n        }\r\n\r\n    }\r\n}\r\n\r\n<\/pre>\n<p>Form1.cs<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\nusing System.Windows.Forms;\r\n\r\nnamespace WindowsFormsApp1\r\n{\r\n    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void btnGenerate_Click(object sender, EventArgs e)\r\n        {\r\n            var objChart = chart.ChartAreas&#x5B;0];\r\n            objChart.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;\r\n            \/\/ month 1-12\r\n            objChart.AxisX.Minimum = 1;\r\n            objChart.AxisX.Maximum = 12;\r\n            \/\/ temperature\r\n            objChart.AxisY.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;\r\n            objChart.AxisY.Minimum = -50;\r\n            objChart.AxisY.Maximum = 50;\r\n            \/\/clear\r\n            chart.Series.Clear();\r\n            \/\/random color\r\n            Random random = new Random();\r\n            \/\/loop rows\r\n            foreach (Temperature t in temperatureBindingSource.DataSource as List&lt;Temperature&gt;)\r\n            {\r\n                chart.Series.Add(t.Location);\r\n                chart.Series&#x5B;t.Location].Color = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256));\r\n                chart.Series&#x5B;t.Location].Legend =&quot;Legend1&quot;;\r\n                chart.Series&#x5B;t.Location].ChartArea = &quot;ChartArea1&quot;;\r\n                chart.Series&#x5B;t.Location].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;\r\n                \/\/adding data\r\n                for (int i = 1; i &lt; 12; i++)\r\n                    chart.Series&#x5B;t.Location].Points.AddXY(i, Convert.ToInt32(t&#x5B;$&quot;M{i}&quot;]));\r\n            }\r\n        }\r\n\r\n        private void Form1_Load_1(object sender, EventArgs e)\r\n        {\r\n            temperatureBindingSource.DataSource = new List&lt;Temperature&gt;();\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/10\/2022-10-26_041420.png?resize=300%2C276&#038;ssl=1\" alt=\"\" width=\"300\" height=\"276\" class=\"alignnone size-medium wp-image-1597\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Temperature.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsFormsApp1 { public class Temperature { public string Location { get; set; } public decimal M1 { get; set; } public decimal M2 { get; set; } public decimal M3 { get; set; } public decimal M4 { get; set; } public decimal [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_lmt_disableupdate":"yes","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[50],"tags":[],"class_list":["post-1596","post","type-post","status-publish","format-standard","hentry","category-c"],"modified_by":"gantovnik","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8bH0k-pK","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1603,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2\/","url_meta":{"origin":1596,"position":0},"title":"#307 Categorize support issues using multiclass classification with ML.NET using C#","author":"gantovnik","date":"2022-10-28","format":false,"excerpt":"Data file: Download the and place to Data folder two files: issues_train.tsv and the issues_test.tsv GitHubIssueData.cs [code language=\"csharp\"] \/\/ <SnippetAddUsings> using Microsoft.ML.Data; \/\/ <\/SnippetAddUsings> namespace GitHubIssueClassification { \/\/ <SnippetDeclareTypes> public class GitHubIssue { [LoadColumn(0)] public string ID { get; set; } [LoadColumn(1)] public string Area { get; set; } [LoadColumn(2)]\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1599,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2\/","url_meta":{"origin":1596,"position":1},"title":"#306 Analyze sentiment of website comments with binary classification in ML.NET using C#","author":"gantovnik","date":"2022-10-27","format":false,"excerpt":"Data file: yelp_labelled.txt SentimentData.cs [code language=\"csharp\"] using Microsoft.ML.Data; \/\/ <\/SnippetAddUsings> namespace SentimentAnalysis { \/\/ <SnippetDeclareTypes> public class SentimentData { [LoadColumn(0)] public string SentimentText; [LoadColumn(1), ColumnName(\"Label\")] public bool Sentiment; } public class SentimentPrediction : SentimentData { [ColumnName(\"PredictedLabel\")] public bool Prediction { get; set; } public float Probability { get; set; }\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1611,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/10\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2\/","url_meta":{"origin":1596,"position":2},"title":"#308 Predict prices using regression with ML.NET using C#","author":"gantovnik","date":"2022-10-30","format":false,"excerpt":"Data file: Download the and place to Data folder two files: taxi-fare-test.csv and taxi-fare-train.csv TaxiTrip.cs [code language=\"csharp\"] \/\/ <Snippet1> using Microsoft.ML.Data; \/\/ <\/Snippet1> namespace TaxiFarePrediction { \/\/ <Snippet2> public class TaxiTrip { [LoadColumn(0)] public string VendorId; [LoadColumn(1)] public string RateCode; [LoadColumn(2)] public float PassengerCount; [LoadColumn(3)] public float TripTime; [LoadColumn(4)] public\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1649,"url":"https:\/\/gantovnik.com\/bio-tips\/2022\/11\/210-parametric-curve-in-3d-2-2-2-2-2-2-2-2-2-2-2-2-2-3-3-2-2-3-2-2-4-2-2-2-2\/","url_meta":{"origin":1596,"position":3},"title":"#313 Spline plot using C# Windows Forms App","author":"gantovnik","date":"2022-11-04","format":false,"excerpt":"Add ScottPlot.WinForms using Manage NuGet packages. Form1.cs [code language=\"csharp\"] using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ScottPlot; namespace Spline { public partial class Form1 : Form { public static class Cubic { \/\/\/ <summary> \/\/\/ Generate a smooth (interpolated) curve that follows the path\u2026","rel":"","context":"In &quot;C#&quot;","block_context":{"text":"C#","link":"https:\/\/gantovnik.com\/bio-tips\/category\/c\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/interpolation.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/interpolation.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/interpolation.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/gantovnik.com\/bio-tips\/wp-content\/uploads\/2022\/11\/interpolation.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":407,"url":"https:\/\/gantovnik.com\/bio-tips\/2019\/02\/updating-all-fields-automatically-in-ms-word\/","url_meta":{"origin":1596,"position":4},"title":"#61 Updating All Fields Automatically in MS Word","author":"gantovnik","date":"2019-02-20","format":false,"excerpt":"[code language=\"python\"] Public Sub UpdateAllFields() 'Programmer: Vladimir Gantovnik 'Date: 01\/15\/2014 Dim rngStory As Word.Range Dim lngJunk As Long Dim oShp As Shape lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType For Each rngStory In ActiveDocument.StoryRanges 'Iterate through all linked stories Do On Error Resume Next rngStory.Fields.Update Select Case rngStory.StoryType Case 6, 7, 8, 9, 10,\u2026","rel":"","context":"In &quot;vba&quot;","block_context":{"text":"vba","link":"https:\/\/gantovnik.com\/bio-tips\/category\/vba\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":432,"url":"https:\/\/gantovnik.com\/bio-tips\/2019\/07\/windows-batch-script-to-print-nth-lines-after-line-containing-matched-string\/","url_meta":{"origin":1596,"position":5},"title":"#63 Batch script to print n-th lines after line containing matched string","author":"gantovnik","date":"2019-07-26","format":false,"excerpt":"[code language=\"python\"] @echo off setlocal enableDelayedExpansion set \"word=VON MISES\" set \"keep=3\" set \"file=model.f06\" find \" X \" model.f06 > extract_weight.txt del extract_stress.txt set n=%keep% for \/f \"usebackq delims=\" %%A in (\"%file%\") do ( set \"ln=%%A\" if \"!ln:%word%=!\" neq \"!ln!\" ( echo( set n=0 ) if !n! lss !keep! ( echo\u2026","rel":"","context":"In &quot;batch&quot;","block_context":{"text":"batch","link":"https:\/\/gantovnik.com\/bio-tips\/category\/batch\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/comments?post=1596"}],"version-history":[{"count":0,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/posts\/1596\/revisions"}],"wp:attachment":[{"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/media?parent=1596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/categories?post=1596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gantovnik.com\/bio-tips\/wp-json\/wp\/v2\/tags?post=1596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}