File tree Expand file tree Collapse file tree 1 file changed +0
-44
lines changed Expand file tree Collapse file tree 1 file changed +0
-44
lines changed Original file line number Diff line number Diff line change 1
1
<p align =" center " ><img src =" http://aparanblog.do.am/fixed.png " ></p ></br ><br >
2
- ``` C#
3
- private Point CorrespondingPoint (Point pt )
4
- {
5
- double xmin = 0 ;
6
- double xmax = 6 . 5 ;
7
- double ymin = - 1 . 1 ;
8
- double ymax = 1 . 1 ;
9
-
10
- var result = new Point
11
- {
12
- X = (pt .X - xmin ) * canvas .Width / (xmax - xmin ),
13
- Y = canvas .Height - (pt .Y - ymin ) * canvas .Height / (ymax - ymin )
14
- };
15
- return result ;
16
- }
17
- private void Draw_Graph_Click (object sender , RoutedEventArgs e )
18
- {
19
- HttpClient client = new HttpClient ();
20
- JavaScriptSerializer jss = new JavaScriptSerializer ();
21
- string url = string .Format (" http://localhost:53901/api/plot" );
22
- client .GetAsync (url ).ContinueWith (resurse =>
23
- {
24
- HttpResponseMessage message = client .GetAsync (url ).Result ;
25
- string responseText = message .Content .ReadAsStringAsync ().Result ;
26
- List < Point > list = jss .Deserialize <List <Point >>(responseText );
27
-
28
- Dispatcher .BeginInvoke (DispatcherPriority .Normal ,
29
- (Action )(() =>
30
- {
31
- foreach (var item in list )
32
- {
33
- polyline .Points .Add (CorrespondingPoint (new Point (item .X , item .Y )));
34
- }
35
- canvas .Children .Add (polyline );
36
- }));
37
- }
38
-
39
-
40
-
41
- );
42
- }
43
-
44
-
45
- ```
46
2
47
3
48
4
<h4 >Author <a href =" https://github.com/tigranv " >Tigran Vardanyan</a ><h4 >
You can’t perform that action at this time.
0 commit comments