Bonjour à tous,

Je souhaite réaliser un polygon annotation sur un graphique (droite définie par des coordonnées X et Y de mon abscisse et de mon ordonnée)

Il semblerait que le polygon annotation soit défini en pixel par rapport au chart area et non en points X et Y par rapports à mes abscisses.

Je voulais savoir s'il était possible de transformer des coordonnées X et Y de mon abscisse et de mon ordonnée en coordonnées pixel ?

Mon graphique :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 Aire2.Name = "Aire2"
                Graph2.ChartAreas.Add(Aire2)
                Graph2.Cursor = Cursors.Cross
 
                Graph2.Location = New System.Drawing.Point(0, 0)
                Graph2.Size = New System.Drawing.Size(982, 662)
 
                Graph2.Titles.Add("Détermination de la morphologie des feuillets en fonction du potentiel chimique en soufre")
                Graph2.Titles(0).Font = New Font("Arial", 14, FontStyle.Bold)
                Graph2.Titles(0).Text = "Détermination de la morphologie des feuillets en fonction du potentiel chimique en soufre"
                Graph2.Titles(0).ForeColor = ParamCalcRay.T2.BackColor
                Graph2.Titles(0).Alignment = System.Drawing.ContentAlignment.MiddleCenter
                Graph2.Titles(0).Docking = Docking.Top
                Graph2.Titles(0).IsDockedInsideChartArea = True
                Graph2.Titles(0).Position.Auto = True
 
                Graph2.ChartAreas(0).AxisX.Title = "Potentiel chimique en soufre (eV)"
                Graph2.ChartAreas(0).AxisX.TitleAlignment = StringAlignment.Center
                Graph2.ChartAreas(0).AxisX.LineWidth = 2
                Graph2.ChartAreas(0).AxisX.MajorGrid.Enabled = False
                Graph2.ChartAreas(0).AxisX.MinorGrid.Enabled = False
                Graph2.ChartAreas(0).AxisX.Crossing = -2
                Graph2.ChartAreas(0).AxisX.TitleFont = New Font("Arial", 12, FontStyle.Bold)
                Graph2.ChartAreas(0).AxisX.TitleForeColor = ParamCalcRay.A2.BackColor
                Graph2.ChartAreas(0).AxisX.LineColor = ParamCalcRay.A2.BackColor
                Graph2.ChartAreas(0).AxisX.Minimum = -2
                Graph2.ChartAreas(0).AxisX.Maximum = 0
                Graph2.ChartAreas(0).AxisX.MajorTickMark.Interval = 0.5
                Graph2.ChartAreas(0).AxisX.MajorTickMark.LineColor = ParamCalcRay.A2.BackColor
                Graph2.ChartAreas(0).AxisX.MajorTickMark.Size = 2
                Graph2.ChartAreas(0).AxisX.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis
                Graph2.ChartAreas(0).AxisX.MinorTickMark.Interval = 0.1
                Graph2.ChartAreas(0).AxisX.MinorTickMark.LineColor = ParamCalcRay.A2.BackColor
                Graph2.ChartAreas(0).AxisX.MinorTickMark.Size = 1
                Graph2.ChartAreas(0).AxisX.MinorTickMark.TickMarkStyle = TickMarkStyle.InsideArea
                Graph2.ChartAreas(0).AxisX.LabelStyle.Font = New Font("Arial", 12, FontStyle.Bold)
                Graph2.ChartAreas(0).AxisX.LabelStyle.ForeColor = ParamCalcRay.A2.BackColor
                Graph2.ChartAreas(0).AxisX.LabelStyle.Interval = 0.5
                Graph2.ChartAreas(0).AxisX.IsMarksNextToAxis = True
 
                Graph2.ChartAreas(0).AxisY.Title = "Pourcentage de bords M (%)"
                Graph2.ChartAreas(0).AxisY.TitleAlignment = StringAlignment.Center
                Graph2.ChartAreas(0).AxisY.LineWidth = 2
                Graph2.ChartAreas(0).AxisY.MajorGrid.Enabled = False
                Graph2.ChartAreas(0).AxisY.MinorGrid.Enabled = False
                Graph2.ChartAreas(0).AxisY.MajorTickMark.Size = 2
                Graph2.ChartAreas(0).AxisY.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis
                Graph2.ChartAreas(0).AxisY.MinorTickMark.Size = 0.5
                Graph2.ChartAreas(0).AxisY.MinorTickMark.TickMarkStyle = TickMarkStyle.InsideArea
                Graph2.ChartAreas(0).AxisY.TitleFont = New Font("Arial", 12, FontStyle.Bold)
                Graph2.ChartAreas(0).AxisY.TitleForeColor = ParamCalcRay.O2.BackColor
                Graph2.ChartAreas(0).AxisY.LineColor = ParamCalcRay.O2.BackColor
                Graph2.ChartAreas(0).AxisY.Minimum = 0
                Graph2.ChartAreas(0).AxisY.Maximum = 100
                Graph2.ChartAreas(0).AxisY.MajorTickMark.Interval = 25
                Graph2.ChartAreas(0).AxisY.MajorTickMark.LineColor = ParamCalcRay.O2.BackColor
                Graph2.ChartAreas(0).AxisY.MajorTickMark.Size = 2
                Graph2.ChartAreas(0).AxisY.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis
                Graph2.ChartAreas(0).AxisY.MinorTickMark.Interval = 5
                Graph2.ChartAreas(0).AxisY.MinorTickMark.LineColor = ParamCalcRay.O2.BackColor
                Graph2.ChartAreas(0).AxisY.MinorTickMark.Size = 1
                Graph2.ChartAreas(0).AxisY.MinorTickMark.TickMarkStyle = TickMarkStyle.InsideArea
                Graph2.ChartAreas(0).AxisY.LabelStyle.Font = New Font("Arial", 12, FontStyle.Bold)
                Graph2.ChartAreas(0).AxisY.LabelStyle.ForeColor = ParamCalcRay.O2.BackColor
                Graph2.ChartAreas(0).AxisY.LabelStyle.Interval = 25
                Graph2.ChartAreas(0).AxisY.IsMarksNextToAxis = True
 
                '   Graph2.ChartAreas(0).AxisY2.LineWidth = 2
                '  Graph2.ChartAreas(0).AxisY2.MajorGrid.Enabled = False
                ' Graph2.ChartAreas(0).AxisY2.MinorGrid.Enabled = False
                'Graph2.ChartAreas(0).AxisY2.LineColor = Param2.Button32.BackColor
                ' Graph2.ChartAreas(0).AxisY2.Minimum = 0
                '  Graph2.ChartAreas(0).AxisY2.Maximum = 100
                '   Graph2.ChartAreas(0).AxisY2.MajorTickMark.Interval = 25
                '    Graph2.ChartAreas(0).AxisY2.MajorTickMark.LineColor = Param2.Button32.BackColor
                '     Graph2.ChartAreas(0).AxisY2.MajorTickMark.Size = 2
                '      Graph2.ChartAreas(0).AxisY2.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis
                '       Graph2.ChartAreas(0).AxisY2.MinorTickMark.Interval = 5
                '        Graph2.ChartAreas(0).AxisY2.MinorTickMark.LineColor = Param2.Button32.BackColor
                '         Graph2.ChartAreas(0).AxisY2.MinorTickMark.Size = 1
                '          Graph2.ChartAreas(0).AxisY2.MinorTickMark.TickMarkStyle = TickMarkStyle.InsideArea
                '           Graph2.ChartAreas(0).AxisY2.LabelStyle.Enabled = False
                '            Graph2.ChartAreas(0).AxisY2.Enabled = AxisEnabled.True
 
                If ParamCalcRay.V5.Checked = True Then
                    S1b.Name = "S1b"
                    Graph2.Series.Add("S1b")
                    Graph2.Series("S1b").Points.DataBindXY(Tx, Ty)
                    Graph2.Series("S1b").ChartType = SeriesChartType.Line
                    Graph2.Series("S1b").BorderWidth = 2
                    Graph2.Series("S1b").ChartArea = "Aire2"
                    Graph2.Series("S1b").ToolTip = "x : #VALX ; y : #VALY"
                    Graph2.Series("S1b").Color = ParamCalcRay.C5.BackColor
                    Graph2.Series("S1b").BorderDashStyle = ChartDashStyle.Solid
                    Graph2.Series("S1b").YAxisType = AxisType.Primary
 
                End If
 
                CalcRay.TabControl1.TabPages(2).Controls.Add(Graph2)
 
               Graph2.Dock = DockStyle.Fill
Exemple pour dessiner un polygon annotation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Dim PolygonAnnotation1 As System.Windows.Forms.DataVisualization.Charting.PolygonAnnotation = New System.Windows.Forms.DataVisualization.Charting.PolygonAnnotation()
        Dim AnnotationPathPoint1 As System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint = New System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint()
        Dim AnnotationPathPoint2 As System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint = New System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint()
        Dim AnnotationPathPoint3 As System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint = New System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint()
        Dim AnnotationPathPoint4 As System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint = New System.Windows.Forms.DataVisualization.Charting.AnnotationPathPoint()
        Dim ChartArea1 As System.Windows.Forms.DataVisualization.Charting.ChartArea = New System.Windows.Forms.DataVisualization.Charting.ChartArea()
        Dim Legend1 As System.Windows.Forms.DataVisualization.Charting.Legend = New System.Windows.Forms.DataVisualization.Charting.Legend()
        Dim Series1 As System.Windows.Forms.DataVisualization.Charting.Series = New System.Windows.Forms.DataVisualization.Charting.Series()
        Me.Chart1 = New System.Windows.Forms.DataVisualization.Charting.Chart()
        CType(Me.Chart1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Chart1
        '
        PolygonAnnotation1.AxisXName = "ChartArea1\rX"
        AnnotationPathPoint1.PointType = CType(0, Byte)
        AnnotationPathPoint1.X = 2.0!
        AnnotationPathPoint2.X = 7.0!
        AnnotationPathPoint3.X = 7.0!
        AnnotationPathPoint3.Y = 60.0!
        AnnotationPathPoint4.X = 2.0!
        AnnotationPathPoint4.Y = 60.0!
        PolygonAnnotation1.GraphicsPathPoints.Add(AnnotationPathPoint1)
        PolygonAnnotation1.GraphicsPathPoints.Add(AnnotationPathPoint2)
        PolygonAnnotation1.GraphicsPathPoints.Add(AnnotationPathPoint3)
        PolygonAnnotation1.GraphicsPathPoints.Add(AnnotationPathPoint4)
        PolygonAnnotation1.Name = "PolygonAnnotation1"
        PolygonAnnotation1.SmartLabelStyle.AllowOutsidePlotArea = System.Windows.Forms.DataVisualization.Charting.LabelOutsidePlotAreaStyle.No
        PolygonAnnotation1.ToolTip = "dkfwknbg"
        PolygonAnnotation1.YAxisName = "ChartArea1\rY"
        Me.Chart1.Annotations.Add(PolygonAnnotation1)
        ChartArea1.Name = "ChartArea1"
        Me.Chart1.ChartAreas.Add(ChartArea1)
        Legend1.Name = "Legend1"
        Me.Chart1.Legends.Add(Legend1)
        Me.Chart1.Location = New System.Drawing.Point(140, 64)
        Me.Chart1.Name = "Chart1"
        Series1.ChartArea = "ChartArea1"
        Series1.Legend = "Legend1"
        Series1.Name = "Series1"
        Me.Chart1.Series.Add(Series1)
        Me.Chart1.Size = New System.Drawing.Size(300, 300)
        Me.Chart1.TabIndex = 0
        Me.Chart1.Text = "Chart1"
        '
        'Form2
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(749, 640)
        Me.Controls.Add(Me.Chart1)
        Me.Name = "Form2"
        Me.Text = "Form2"
        CType(Me.Chart1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
Je ne sais pas à quoi correspond le ! dans les lignes suivantes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
AnnotationPathPoint1.X = 2.0!
        AnnotationPathPoint2.X = 7.0!
        AnnotationPathPoint3.X = 7.0!
        AnnotationPathPoint3.Y = 60.0!
        AnnotationPathPoint4.X = 2.0!
        AnnotationPathPoint4.Y = 60.0!
, est ce que quelqu'un saurait ?

Merci d'avance pour votre aide