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

Message ListMessage List     Post MessagePost Message

  Bar chart - grid, bar width and bars gap doubts
Posted by Marcelo Camarate on Nov-28-2018 07:52
Attachments:
Hi,

I have a bar chart and I can not solve two problems. For understanding, see the two images at the end of this post.


(1)
I need the grid and its scale values do not shown. I even remove the grid setting its color equal transparent. But, I can not do the same with its values (red outline).
How cah I do This?

(2)
As I have variable quantity of values for the X axis, I need to calculate the width of the bars. I can do this using "layer.setBarWidth(barwidth)", but I want that the bars to be aligned at left.
Also, I want to decrease the spacing between the bars (red arrow). I tried using "layer.setBarGap(value)" and "layer.setBarWidth (barwidth)" together, but did not work.
Is it possible to do that?

Finally, I have an official version 4.1 of ChartDirector and would like that suggestions to work in it.

Thanks in advance,

Marcelo Camarate
ChartDirector1.JPG
ChartDirector2.JPG

  Re: Bar chart - grid, bar width and bars gap doubts
Posted by Peter Kwan on Nov-28-2018 16:14
Hi Marcelo,

The "values" are axis labels. You can set the axis, including its labels, to transparent.

c.yAxis().setColors(Chart.Transparent, Chart.Transparent)

(Note: Depending on your programming language, the Chart.Transaprent can be called Transparent or cd.Transparent or other names.)

The width of the bar is the width of the bar itself, which is not the same as the distance between the bars. The distance between the bars are related to the x-axis scale.

Because an XYChart can contain multiple layers (eg. a bar layer, some line layers, scatter layers all in one chart), so no layer can directly control the x-axis (otherwise the layers may conflict with each others). In your case, the x-axis is specified by using Axis.setLabels with two labels. So ChartDirector will distribute the labels evenly along the x-axis.

If you want to x-axis to have more label positions, please use (in VB.NET syntax):

Dim labels() As String = { "Label 1", "Label 2", "", "", "", "", "", "", "", "" }
c.xAxis().setLabels(labels)

The axis will now have 10 labels, only the first two are visible. The two bars will align with the first two labels. This should be what you want.

Regards
Peter Kwan