ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  DrawArea.polygon - points as object
Posted by Craig R on Oct-20-2020 06:49
Hello Peter,

Can you please give me a vb.net code example of using below to draw a polygon;
I cannot get the points() As Object to work

Public Sub polygon(points() As Object, edgeColor As Integer, fillColor As Integer)

Regards
Craig R

  Re: DrawArea.polygon - points as object
Posted by Peter Kwan on Oct-20-2020 15:05
Hi Craig,

You can try:

Dim d As DrawArea = c.makeChart()
Dim points(2) As Object
points(0) = New Integer() { 100, 100}
points(1) = New Integer() { 200, 200}
points(2) = New Integer() { 200, 100}

d.polygon(points, &HFF0000, &HFFFF00)

Hope this can help.

Regards
Peter Kwan

  Re: DrawArea.polygon - points as object
Posted by Craig R on Oct-24-2020 06:37
Thanks Peter,

Is there a way to scale a drawarea that has polygon and lines.
I looked at AffineTransform, but that does not scale the drawarea.

Regards
Craig Roberts

  Re: DrawArea.polygon - points as object
Posted by Peter Kwan on Oct-26-2020 18:47
Hi Craig,

In the current version of ChartDirector, the best way to scale a drawarea is to create a new DrawArea of the required size. The only thing you need to do is to develop your original code to use variable size. For example:

Dim scaleFactor = 1

Dim d As DrawArea = c.makeChart()
Dim points(2) As Object
points(0) = New Integer() { 100 * scaleFactor, 100 * scaleFactor}
points(1) = New Integer() { 200 * scaleFactor, 200 * scaleFactor}
points(2) = New Integer() { 200 * scaleFactor, 100 * scaleFactor}

The following is an example in which the entire meter is scalable to any size. It is using the same technique, which is to use variable size in the code.

https://www.advsofteng.com/doc/cdnet.htm#neonroundmeter.htm

Regards
Peter Kwan

  Re: DrawArea.polygon - points as object
Posted by Chuck on Nov-17-2020 00:09
Hi Peter,

Regarding drawing Polygons... how can the polygon be drawn “on top” of the Chart Bar (such as an OHLCV Chart). Is there a Z-order assignment?

Thank you,
Chuck

  Re: DrawArea.polygon - points as object
Posted by Chuck Van Dien on Nov-17-2020 01:52
Attachments:
Peter,

Attached are 2 images PolygonBeneath.png and PolygonOnTop.png... Currently, my polygon is being drawn beneath the Bar... how can I get the "On Top" effect where the polygon would be drawn on top of the Bar... I am using a Scatter Layer

Dim symbolLayer As ScatterLayer = PriceChart.addScatterLayer(...)

is there a way to set the Z order of the scatter layer?

Thank you,
Chuck
PolygonOnTopBar.png
PolygonBeneathBar.PNG

  Re: DrawArea.polygon - points as object
Posted by Peter Kwan on Nov-18-2020 21:42
Hi Chuck Van Dien,

If your code draws the polygon using a scatter layer, you can move the scatter layer to the top by one of the following methods:

(a) Add the scatter layer first, followed by other layers. The layer that is added first will stay on top.

(b) Use Layer.moveFront to move the scatter layer to the front.

https://www.advsofteng.com/doc/cdnet.htm#Layer.moveFront.htm

Hope this can help.

Regards
Peter Kwan

  Re: DrawArea.polygon - points as object
Posted by Chuck on Nov-19-2020 23:02
Peter,

Regarding adding Polygons to a Scatter Layer... what is the most reliable method of adding a Tooltip to the polygon?

Thank you,
Chuck

  Re: DrawArea.polygon - points as object
Posted by Peter Kwan on Nov-20-2020 16:38
Hi Chuck,

Most of the ChartDirector Windows Forms sample code include tooltips for the data representation (slices for pie charts, bars for bar charts, symbols for scatter charts, etc). There are several methods:

(a) If all layers has the same tooltip format (eg. to display the data value), you may use one getHTMLImageMap line to configure the tooltip for the whole chart and then assign it to the WinChartViewer. For example:

https://www.advsofteng.com/doc/cdnet.htm#symbolline2.htm

(b) If each layer needs to use a different tooltip format, you can use setHTMLImageMap to configure the tooltip for the layers, and then use getHTMLImageMap to assign them to the WinChartViewer. See:

https://www.advsofteng.com/doc/cdnet.htm#scattertrend.htm

(c) If you want to disable tooltip for a particular layer, you can use layer.setHTMLImageMap("{disable}") to do this.

(d) If you just want to have tooltip for one layer only, you can also use layer.getHTMLImageMap instead of c.getHTMLImageMap.

Hope this can help.

Regards
Peter Kwan

  Re: DrawArea.polygon - points as object
Posted by Craig R on Nov-03-2020 03:59
Thanks Peter.