|
Tag with consective numbers |
Posted by icm63 on Oct-06-2018 01:47 |
|
I wish to tag the pivot with consecutive numbering.
Like Ex1
How can I load numbers, with out using a image, I would like to use a string array 1, 2, 3, ect
How is this done?
This is my function for some of my code (vb.net)
Private Sub DrawSwingsPivots(ByVal myXYChart As XYChart, ByVal data() As RTT_Structures.VOLSwings, ByVal Close() As Double, _
ByVal PriceOnly As Boolean)
If data.Length < 1 Then Exit Sub
Dim HPiv() As Double
Dim LPiv() As Double
HPiv = Calc_SwingPricePivot("U", data, Close)
LPiv = Calc_SwingPricePivot("D", data, Close)
Dim HLayer As Layer = myXYChart.addScatterLayer(Nothing, HPiv, "", Chart.SquareShape, ChartDToolTipSquareSize, Chart.Transparent, Chart.Transparent)
Dim HBox As ChartDirector.TextBox = HLayer.setDataLabelStyle("Arial", 8)
HBox.setBackground(Chart.Transparent, BackGroundTextColor)
HBox.setAlignment(2)
HBox.setFontColor(BackGroundTextColor)
If PriceOnly = True Then
HLayer.setDataLabelFormat("{value|2}")
Else
HLayer.setDataLabelFormat("{value|2}" & vbLf & "{xLabel|mm/dd/yyyy}")
End If
Dim LLayer As Layer = myXYChart.addScatterLayer(Nothing, LPiv, "", Chart.SquareShape, ChartDToolTipSquareSize, Chart.Transparent, Chart.Transparent)
Dim LBox As ChartDirector.TextBox = LLayer.setDataLabelStyle("Arial", 8)
LBox.setBackground(Chart.Transparent, BackGroundTextColor)
LBox.setAlignment(8)
LBox.setFontColor(BackGroundTextColor)
If PriceOnly = True Then
LLayer.setDataLabelFormat("{value|2}")
Else
LLayer.setDataLabelFormat("{xLabel|mm/dd/yyyy}" & vbLf & "{value|2}")
End If
End Sub
Thanks
|
Re: Tag with consective numbers |
Posted by Peter Kwan on Oct-10-2018 03:17 |
|
Hi icm63,
To put the numbers on the chart, please add a scatter layer with the symbols at the positions that you want the numbers to appear. Set the symbol fill and edge color to transparent so it will not actually show the symbol. Add your string array as an extra field (see Layer.addExtraField) to the scatter layer. Then configure the data label to display the extra field with center alignment.
HLayer.addExtraField(anArrayOfTextStrings)
HLayer.setDataLabelFormat("{field0}")
HLayer.setDataLabelStyle("Arial", 10, &H00000).setAlignment(Chart.Center)
Regards
Peter Kwan |
Re: Tag with consective numbers |
Posted by icm63 on Oct-10-2018 04:44 |
|
Thanks |
Re: Tag with consective numbers |
Posted by icm63 on Oct-10-2018 06:20 |
|
Ooops the data is not showing up in chart
My code
#populate data label arrays
HPiv = Calc_SwingPricePivot(1, "U", data, Close, 0)
LPiv = Calc_SwingPricePivot(1, "D", data, Close, 0)
HPivID = Calc_SwingPricePivot(3, "U", data, Close, 0)
LPivID = Calc_SwingPricePivot(3, "D", data, Close, 0)
example of content of arrays
1010 11:13:38 # TEST9: 715 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 716 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 717 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 718 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 719 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 720 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 721 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 722 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 723 / 10.09 / 2 <<<<< HERE HPiv and HPivID
1010 11:13:38 # TEST9: 724 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 725 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 726 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 727 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 728 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 729 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 730 / 1.7E+308 / 1.7E+308
1010 11:13:38 # TEST9: 731 / 1.7E+308 / 1.7E+308
# Place array in data label
Dim HLayer As Layer = myXYChart.addScatterLayer(Nothing, HPiv, "", Chart.SquareShape, ChartDToolTipSquareSize, Chart.Transparent, Chart.Transparent)
HLayer.addExtraField2(HPivID)
Dim HBox As ChartDirector.TextBox = HLayer.setDataLabelStyle("Arial", 8)
HBox.setBackground(Chart.Transparent, BackGroundTextColor)
HBox.setAlignment(2)
HBox.setFontColor(BackGroundTextColor)
HBox.setBackground(Chart.Transparent, Chart.Transparent)
If PriceOnly = True Then
HLayer.setDataLabelFormat("{value|2} xx {field0} xx") <<< NOTICE xx
Else
HLayer.setDataLabelFormat("{value|2} {field0}" & vbLf & "{xLabel|mm/dd/yyyy}")
End If
On the image below you see 10.09 xx xx . The {field0} data should be between the x's but it is NOT, what am I missing ????
|
Re: Tag with consective numbers |
Posted by icm63 on Oct-10-2018 11:18 |
|
ALL good
Worked it out
The addExtraField2 must only equal the data points viewing on the chart ( ie remove extrabars for financial charts) |
|