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

Message ListMessage List     Post MessagePost Message

  two horizontal bar charts overlain
Posted by Michael on Oct-01-2025 18:47
Attachments:
Hello Peter,
I would like to overlay two horizontal bar charts, one progressing to the right and the other progressing to the left.  The second chart's bar starts at the right end of the first.

The chart is to provide a quick glance image of forward and reflected radio power.  A portion of the transmitter's output is reflected.  The attached PowerPoint cartoon shows the idea.

I can already make a bar-shaped area layer chart using the techniques from https://www.advsofteng.com/doc/cdpydoc/varwidthbar.htm .  I tried to combine the forward and reflected bar charts in a MultiChart but I can't align the axes.  I don't understand the reference frame for Chart.GetYCoor and Layer.GetYCoor so their values don't help alignment.  Do you have a suggestion?
Power bar chart.jpg

  Re: two horizontal bar charts overlain
Posted by Peter Kwan on Oct-02-2025 00:05
Attachments:
Hi Michael,

For the "reflected bar", you can use a floating box chart layer. Some examples of this type of chart is at:

https://www.advsofteng.com/doc/cdpython.htm#waterfall.htm

The API is:

https://www.advsofteng.com/doc/cdpython.htm#XYChart.addBoxLayer.htm

Basically, you just need to provide the x-values for the left and right side of the horizontal box. You can configure the vertical height of the box to be smaller than that of the bar, so that the box will stay inside the bar. Below is a simple example:


c = XYChart(600, 300)

barData = [100, 200, 300, 400]
boxStart = [50, 130, 210, 290]

c.setPlotArea(80, 50, 450, 220)
c.swapXY()

c.addBoxLayer(boxStart, barData, 0x4466aa).setDataGap(0.6)
c.addBarLayer(barData, 0xbbddff)

c.makeChart("test.png")
test.png

  Re: two horizontal bar charts overlain
Posted by Michael on Oct-02-2025 03:48
Peter -
Fantastic, just what I needed.  I never would have known about this solution without your help.
Best - Michael