@@ -14,57 +14,33 @@ public static class VectorSeriesExamples
1414 [ DocumentationExample ( "Series/VectorSeries" ) ]
1515 public static PlotModel FromItems ( )
1616 {
17- const int NumberOfItems = 100 ;
18- var model = new PlotModel { Title = "VectorSeries" } ;
19-
20- var rand = new Random ( 1 ) ;
21- var w = 100.0 ;
22- var h = 100.0 ;
23- var max = 10.0 ;
24-
25- model . Axes . Add ( new LinearColorAxis
26- {
27- Position = AxisPosition . Right ,
28- Palette = new OxyPalette ( OxyPalettes . Cool ( 10 ) . Colors . Select ( c => OxyColor . FromAColor ( 100 , c ) ) ) ,
29- Minimum = 0.0 ,
30- Maximum = max ,
31- } ) ;
32-
33- model . Axes . Add ( new LinearAxis ( )
34- {
35- Position = AxisPosition . Bottom ,
36- Minimum = - max ,
37- Maximum = w + max ,
38- } ) ;
39- model . Axes . Add ( new LinearAxis ( )
40- {
41- Position = AxisPosition . Left ,
42- Minimum = - max ,
43- Maximum = h + max ,
44- } ) ;
45-
46- var s = new VectorSeries ( ) { LabelFontSize = 12 } ;
47- for ( int i = NumberOfItems - 1 ; i >= 0 ; i -- )
48- {
49- var ang = rand . NextDouble ( ) * Math . PI * 2.0 ;
50- var mag = rand . NextDouble ( ) * max ;
51-
52- var origin = new DataPoint ( rand . NextDouble ( ) * w , rand . NextDouble ( ) * h ) ;
53- var direction = new DataVector ( Math . Cos ( ang ) * mag , Math . Sin ( ang ) * mag ) ;
54- s . Items . Add ( new VectorItem ( origin , direction , mag ) ) ;
55- }
56-
57- model . Series . Add ( s ) ;
17+ var model = GetModel ( out _ ) ;
18+ return model ;
19+ }
5820
21+ [ Example ( "VectorSeries (Veeness = 2)" ) ]
22+ [ DocumentationExample ( "Series/VectorSeries" ) ]
23+ public static PlotModel FromItemsVeeness ( )
24+ {
25+ var model = GetModel ( out var series ) ;
26+ series . Veeness = 2 ;
5927 return model ;
6028 }
6129
62- [ Example ( "VectorSeriesV " ) ]
30+ [ Example ( "VectorSeries (Vector Origin and Label position) " ) ]
6331 [ DocumentationExample ( "Series/VectorSeries" ) ]
64- public static PlotModel FromItemsv ( )
32+ public static PlotModel FromItemsVectorOriginAndLabelPosition ( )
33+ {
34+ var model = GetModel ( out var series ) ;
35+ series . VectorLabelPosition = 0.25 ;
36+ series . VectorOriginPosition = 0.5 ;
37+ return model ;
38+ }
39+
40+ private static PlotModel GetModel ( out VectorSeries series )
6541 {
6642 const int NumberOfItems = 100 ;
67- var model = new PlotModel { Title = "VectorSeries" } ;
43+ var model = new PlotModel { Title = "VectorSeries (Veeness = 2) " } ;
6844
6945 var rand = new Random ( 1 ) ;
7046 var w = 100.0 ;
@@ -92,18 +68,18 @@ public static PlotModel FromItemsv()
9268 Maximum = h + max ,
9369 } ) ;
9470
95- var s = new VectorSeries ( ) { LabelFontSize = 12 , Veeness = 2 } ;
71+ series = new VectorSeries ( ) { LabelFontSize = 12 , Veeness = 2 } ;
9672 for ( int i = NumberOfItems - 1 ; i >= 0 ; i -- )
9773 {
9874 var ang = rand . NextDouble ( ) * Math . PI * 2.0 ;
9975 var mag = rand . NextDouble ( ) * max ;
10076
10177 var origin = new DataPoint ( rand . NextDouble ( ) * w , rand . NextDouble ( ) * h ) ;
10278 var direction = new DataVector ( Math . Cos ( ang ) * mag , Math . Sin ( ang ) * mag ) ;
103- s . Items . Add ( new VectorItem ( origin , direction , mag ) ) ;
79+ series . Items . Add ( new VectorItem ( origin , direction , mag ) ) ;
10480 }
10581
106- model . Series . Add ( s ) ;
82+ model . Series . Add ( series ) ;
10783
10884 return model ;
10985 }
0 commit comments