|
Chart Rotation, or Axis Inversion on an XY Chart? |
Posted by Jeff on Jan-16-2025 04:24 |
|
Peter,
Is it possible to invert the axis so x is y and y is x? on an XY chart?
the first image attached is how we are normally going to construct the chart, but the rotated picture is a view we call 'swimlanes' in our product. Is it possible?
thanks ,
Jeff
|
Re: Chart Rotation, or Axis Inversion on an XY Chart? |
Posted by Peter Kwan on Jan-16-2025 14:25 |
|
Hi Jeff,
You may try XYChart.swapXY. For example:
myChart.swapXY()
Best Regards
Peter Kwan |
Re: Chart Rotation, or Axis Inversion on an XY Chart? |
Posted by Jeff on Jan-16-2025 21:38 |
|
Wow that got me really close!
Attached is the result. I THINK all the labels are properly centered, but its hard to tell.
The thing I need to do is make the columns much narrower as to get space and separation between them,
Thanks,
Jeff
|
Re: Chart Rotation, or Axis Inversion on an XY Chart? |
Posted by Peter Kwan on Jan-16-2025 23:27 |
|
Hi Jeff,
I remembered in our previous communication, I had suggested to calculate the bar width to use so that we can determine the maximum text width for wrapping the text. The bar width formula I used was:
Dim barWidth As Integer = Int(c.getPlotArea().getWidth() / (xEnd - xStart) * (1 - gapRatio))
The code then set the bar width (using setDataWidth) to the calculated barWidth.
With swapXY, the getWidth in the above code should be replaced by getHeight.
I think with swapXY, it is not necessary to calculate the barWidth at all, as the text flow is now in the same direction as the bar. You can replace the layer.setDataWidth(barWidth) to layer.setDataGap(gapRatio) instead.
Best Regards
Peter Kwan |
Re: Chart Rotation, or Axis Inversion on an XY Chart? |
Posted by Jeff on Jan-17-2025 02:21 |
|
That did it:
'Invert axis if we wish to see swim lanes
If SwimLaneView = True Then
c.setPlotArea(80, 25, c.getWidth() - 80, c.getHeight() - 70).setGridColor(&HC0C0C0, &HC0C0C0)
barWidth = Int(c.getPlotArea().getHeight() / (xEnd - xStart) * (1 - gapRatio))
c.swapXY()
Else
c.setPlotArea(50, 25, c.getWidth() - 80, c.getHeight() - 70).setGridColor(&HC0C0C0, &HC0C0C0)
barWidth = Int(c.getPlotArea().getWidth() / (xEnd - xStart) * (1 - gapRatio))
End If
I gave the X-Axis 30 more pixels as it needs more room for the labels.
Thanks again!
|
|