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

Message ListMessage List     Post MessagePost Message

  Offset of 2 or more series in Z order
Posted by Chuck on Jan-24-2020 02:48
Attachments:
Peter,

I have an odd request...

On an OHLC Financial Chart that overlays 2 or more series (imagine 2 or more different OHLC symbols data stacked in a Z order...) is there a way to slightly offset the Bars (that are stacked in a Z order) such has that the bars that are under other bars can be seen and not hidden by the bar on top of it?

To illustrate this, let’s say the same OHLC data is duplicated 3 times, stacked in a Z order of 1,2,3 with 3 on the top layer, 1 on the bottom layer... (for this example) only series #3 would be seen (because it completely covers 2 and 1) Is there a way to slightly offset 2 and 1 so that these are completely covered, that 2 and 1 can slightly be seen?

In application, 2 or more OHLC datasets may cover some of the bars under them (and not all of them like my extreme example above) the goal I’m seeking by slightly offsetting the entire series is to not cover completely any single bar, such that at least the High/Low could be seen in comparison to the other OHLC series bars.

I attached an image of what I am after for a single X-Axis interval.

Thank you for your help.
Chuck
6A7C7510-AAE5-4800-9078-CD2A80F89729.jpeg

  Re: Offset of 2 or more series in Z order
Posted by Peter Kwan on Jan-24-2020 16:53
Hi Chuck,

When you add a OHLC layer, you may use Layer.setXData2 to shift it a little bit. It is like:

Dim myLayer = myXYChart.addHLOCLayer(.....)
myLayer.setXData(0.1, Ubound(closeData) - extraDays + 0.1)

extraDays is the extraDays parameter your code use in FinanceChart.setData in case you are using a FinanceChart object. Otherwise it s 0.

The above shift the symbol by 10% of the distance between the symbols. Note that if you shift more than 50%, the symbol will be closer to the next bar than the current bar.

Regards
Peter Kwan

  Re: Offset of 2 or more series in Z order
Posted by Chuck on Jan-24-2020 21:59
Thank you Peter. The Chart Director Control is a pleasure to work with.
Chuck

  Re: Offset of 2 or more series in Z order
Posted by Chuck on Jan-24-2020 22:09
Peter, I have a quick follow-up...

Is there a way to dynamically set which dataset/series appears on the top Z order? This is so the user can select which series (of the 2 or more series described above) appears on the top after the Chart has been generated.

Thank you,
Chuck

  Re: Offset of 2 or more series in Z order
Posted by Peter Kwan on Jan-25-2020 11:43
Hi Chuck,

In ChartDirector, there is no need to write any additional code to allow users to select the order of the series.

You may refer to the "Interactive Financial Chart" sample code for an example:

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

In the above code, when the chart first appears, the state of the user interface is at its default configuration. The charting code subroutine just draws based on the state of the user interface.

When the user changes the state of the user interface, no matter what has changed, the same charting subroutine is used to redraw the chart.  So no additional charting code is necessary. The code that is used to draw the initial chart can be used for updating the chart too.

Hope this can help.

Regards
Peter Kwan

  Re: Offset of 2 or more series in Z order
Posted by Chuck on Jan-25-2020 22:22
Hi Peter,

Thank you for your reply.

I reviewed the code, however, I want the user to specifically direct (his selection) of the Z Order of the 2 or more series....

For instance, using the previous post above as an example, with 3 series, displaying Red, purple, Blue, where blue is on TOP of the Z Order....

My user then issues a command to make the RED series the TOP of the Z Order (bringing it from the bottom to the top).

Is there a command to specifically perform this reordering of the displayed Z Order?

In my case, compared to your example, the user initiates the series (red) that he wishes to bring to the TOP.

Thank you for your help.
Chuck

  Re: Offset of 2 or more series in Z order
Posted by Peter Kwan on Jan-27-2020 01:03
Attachments:
Hi Chuck,

You mentioned "My user then issues a command to make the RED series the TOP of the Z Order". I assume this means you will design a user interface, and the user can use the user interface to "make the RED series the TOP of the Z Order".

In this case, it is the similar to the Interactive Financial Chart. Note that in this example, there is a user interface on the left side. The user can use it to specify the vertical ordering of the technical indicators. This is by the user selecting the indicators from the drop down list box in the order he wants. The charting code simply draws the chart according to the state of the user interface.

I have attached an example user interface. It is the user interface in Visual Studio used to customize the menu bar. The user can add, remove and change the ordering of the items in the list box.

Suppose you have a similar user interface to allow your user to change the z-order. The charting code only needs to draw based on the items the list box. There is no need to have any command to change the z-order in the charting code. The z-order is changed in the user interface, not in the charting code.

Hope this can help.

Regards
Peter Kwan
ordering_user_interface.png

  Re: Offset of 2 or more series in Z order
Posted by Chuck on Jan-27-2020 01:59

Thanks Peter, I missed the ordering of the indicators on my first review. I’ll dig into the example again... I had it in my mind that the series may have a Z Order property that simply could be set... I look how the dropdown drives the rendering instead.

Thank you again for your follow up.

Chuck

  Re: Offset of 2 or more series in Z order
Posted by Chuck on Apr-10-2020 05:50
Jeff,

I have a new question based on this functionality described in the above thread... you helped me display 3 “series” of data that falls on the same X Axis and offsetting each so they aren’t hidden by one another.... that said, using this configuration...

Can you point me to a VB.NET example where the Tracker Cursor can display the OHLCV info on each of the 3 “series”?

Currently, with no code modification, it appears that the “left most” of the combination of 3 series is displaying via the Tracker Cursor... how can I make the Tracker Cursor fall on each series (that is Offset from the X Axis they are all on) to give me the info of each one individually?

(Hope this was clear, I can provide a screen shot if clear...)

Thank you!
Chuck

  Re: Offset of 2 or more series in Z order
Posted by Peter Kwan on Apr-10-2020 15:56
Hi Chuck,

Unluckily, we do not have an example that matches you exact requirements.

Are you using the code similar to the "Finance Chart Track Line" sample code? If you read the code, you can see that the "nearest x value" (the position nearest to the mouse cursor) is rounded to an integer in the sample code. For the code in this post, the "other" OHLC bars are at non-integral x-coordinates. If the mouse is over them, the "nearest x value" will be non-integer, which will then be rounded to an integer by the sample code, and this will corresponds to the "main" OHLC.

For your case, you can remove the rounding in the sample code. In this case, it should display the OHLC that is at the mouse position. However, the time stamp label (if you display them as well) will not be correct, because in the sample code, the timestamps are only at integral x value. So you may want to modify the code to create the timestamp by using rounded x-value.

Regards
Peter Kwan