Hello group,
I am new to this forum, but have been using TeeChart for around two years. I have a project that requires a graph that shows a safe operating region for a product. The safe operating region needs to be cross-hatched or filled with a color to make it very noticeable. The region is always a multi-sided polygon. I am wondering if there is a method for cross-hatching a region. I know the Shapes method allows a Fill, but Shapes can only be regular, like a square or a rectangle or circle. I am preparing to write the cross-hatching routines myself, but don't have a lot of time to spend on it, so if anyone knows of a method in TeeChart to do this I would appreciate your comments.
Thanks,
Bob
Cross-hatching regions in graph
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi Bob,
Have you thought about using a Map series? The following maybe the sort of thing you're looking for:I know the Shapes method allows a Fill, but Shapes can only be regular, like a square or a rectangle or circle. I am preparing to write the cross-hatching routines myself, but don't have a lot of time to spend on it, so if anyone knows of a method in TeeChart to do this I would appreciate your comments.
Code: Select all
Private Sub AddShape(X, Y As Variant, Color As OLE_COLOR, Label As String)
Dim tmpIndex
With TChart1.Series(0).asMap
tmpIndex = .Shapes.Add
For i = 0 To UBound(X)
.Shapes.Polygon(tmpIndex).AddXY X(i), Y(i)
Next i
.Shapes.Polygon(tmpIndex).ParentBrush = False
If i < 20 Then
.Shapes.Polygon(tmpIndex).Brush.Style = i
End If
.Shapes.Polygon(tmpIndex).Color = Color
.Shapes.Polygon(tmpIndex).Text = Label
.Shapes.Polygon(tmpIndex).Z = Rnd * 1000 / 1000
End With
End Sub
Private Sub Form_Load()
TChart1.AddSeries scMap
TChart1.Aspect.View3D = False
AX = Array(1, 3, 4, 4, 5, 5, 6, 6, 4, 3, 2, 1, 2, 2)
AY = Array(7, 5, 5, 7, 8, 9, 10, 11, 11, 12, 12, 11, 10, 8)
BX = Array(5, 7, 8, 8, 7, 6, 5, 4, 4)
By = Array(4, 4, 5, 6, 7, 7, 8, 7, 5)
CX = Array(9, 10, 11, 11, 12, 9, 8, 7, 6, 6, 5, 5, 6, 7, 8, 8)
CY = Array(5, 6, 6, 7, 8, 11, 11, 12, 11, 10, 9, 8, 7, 7, 6, 5)
DX = Array(12, 14, 15, 14, 13, 12, 11, 11)
DY = Array(5, 5, 6, 7, 7, 8, 7, 6)
EX = Array(4, 6, 7, 7, 6, 6, 5, 4, 3, 3, 2)
EY = Array(11, 11, 12, 13, 14, 15, 16, 16, 15, 14, 13)
FX = Array(7, 8, 9, 11, 10, 8, 7, 6, 5, 5, 6, 6)
FY = Array(13, 14, 14, 16, 17, 17, 18, 18, 17, 16, 15, 14)
GX = Array(10, 12, 12, 14, 13, 11, 9, 8, 7, 7, 8, 9)
GY = Array(10, 12, 13, 15, 16, 16, 14, 14, 13, 12, 11, 11)
HX = Array(17, 19, 18, 18, 17, 15, 14, 13, 15, 16)
HY = Array(11, 13, 14, 16, 17, 15, 15, 14, 12, 12)
IX = Array(15, 16, 17, 16, 15, 14, 14, 13, 12, 11, 10, 11, 12, 13, 14)
IY = Array(6, 6, 7, 8, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 7)
JX = Array(15, 16, 16, 17, 17, 16, 15, 13, 12, 12, 14, 14)
JY = Array(8, 8, 9, 10, 11, 12, 12, 14, 13, 12, 10, 9)
KX = Array(17, 19, 20, 20, 19, 17, 16, 16, 17, 16)
KY = Array(5, 5, 6, 8, 8, 10, 9, 8, 7, 6)
LX = Array(19, 20, 21, 21, 19, 17, 17)
LY = Array(8, 8, 9, 11, 13, 11, 10)
AddShape AX, AY, vbBlue, "A"
AddShape BX, By, vbRed, "B"
AddShape CX, CY, vbYellow, "C"
AddShape DX, DY, vbGreen, "D"
AddShape EX, EY, vbCyan, "E"
AddShape FX, FY, vbBlue, "F"
AddShape GX, GY, vbMagenta, "G"
AddShape HX, HY, vbWhite, "H"
AddShape IX, IY, vbYellow, "I"
AddShape JX, JY, vbBlack, "J"
AddShape KX, KY, vbGreen, "K"
AddShape LX, LY, vbRed, "L"
End Sub
Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
TChart1.StopMouse
MsgBox TChart1.Series(0).PointLabel(ValueIndex)
End Sub
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Chris,
Thanks for the suggestion. The code you sent appears to be doing what I was needing, but, it won't run on the version of TeeChart that I have (version 4.02). At least that is what it seems to be. The .asMap method doesn't appear in my Graph list. When I try to run your sample code I get run time error 438, "Object doesn't support this property or method". What version does the Map method appear in?
Best regards,
Bob
Thanks for the suggestion. The code you sent appears to be doing what I was needing, but, it won't run on the version of TeeChart that I have (version 4.02). At least that is what it seems to be. The .asMap method doesn't appear in my Graph list. When I try to run your sample code I get run time error 438, "Object doesn't support this property or method". What version does the Map method appear in?
Best regards,
Bob
Hi Bob,
The "asMap" method has been added in the TeeChart Pro v5 and above.code I get run time error 438, "Object doesn't support this property or method". What version does the Map method appear in?
Pep Jorge
http://support.steema.com
http://support.steema.com
Same approach for .NET?
Actually this is the same thing I need to do, but I have the TeeChart for .NET v 1. Is this approach available in that version? I do not need the transparancy(right now any way)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi tekwiz,
No, map series were implemented in TeeChart for .NET v2. So if you want to use them you'll need to upgrade your license.
No, map series were implemented in TeeChart for .NET v2. So if you want to use them you'll need to upgrade your license.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |