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

Message ListMessage List     Post MessagePost Message

  How to show only y values on center of bar and remove 0 range from bottom using asp.net netchartdir.dll
Posted by Jayant Sharma on Dec-11-2014 20:11
Attachments:
I want to show bar values at middle , Currently it is showing on whole edges of bar i want
to remove 0 range from chart and display value at middle.

I used following methods:

layer.setAggregateLabelStyle()
layer.setDataLabelStyle().setAlignment(Chart.Center)
layer.setDataLabelStyle()
but i couldn't get the currect solution yet please help..!!

Here is my screen shot what i have on chart and what i need

i used asp.net netchartdir.dll
chart.png

  Re: How to show only y values on center of bar and remove 0 range from bottom using asp.net netchartdir.dll
Posted by Peter Kwan on Dec-12-2014 03:54
Hi Jayant,

For your case, I assume you are using the method in the "Variable Width Bar Chart", in
which each bar is actually added as a separate area layer.

To achieve what you need, you may create an additional layer that contains the label
positions, and add the label to that layer. It is like:


Dim labelX As New List(Of Double)
Dim labelY As New List(Of Double)

For i As Integer = 0 To UBound(data)
    ' ending position of current bar
    Dim nextX As Double = currentX + widths(i)

    'Position of labels
    labelX.Add((currentX + nextX) / 2)
    labelY.Add(data(i))

    .... create the bars using area layers as usual ....

Next

'An transparent layer containing the label position
Dim labelLayer As LineLayer = c.addLineLayer(labelY, Chart.Transparent)
labelLayer.setXData(labelX)

'Show the labels
labelLayer.setDataLabelStyle()


Hope this can help.

Regards
Peter Kwan