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

Message ListMessage List     Post MessagePost Message

  X-Axis grids won't display in productivity bar chart
Posted by Patrick Plummer on Feb-14-2011 10:25
Hi...I've tried everything I can think of and have researched everywhere else before I'm
writing this asking you for help...I know you're busy.

http://www.advsofteng.com/images/posnegbar.png

I have modified the posnegbar graph in your samples for my use elsewhere...in the sample
picture listed at the URL above, how could I get a simple line beginning at the marker for
each month up to the top of the chart...

I have used:

.setTickColor(&H008000)
.setTickLength(2)
.setTickDensity(15)

and nothing seems to work...I expect it's something with teh zones covering them up, but
wow I cannot get them to show...

Could you please answer how?

thank you in advance. Patrick.

  Re: X-Axis grids won't display in productivity bar chart
Posted by Peter Kwan on Feb-15-2011 09:38
Hi Patrick,

The grid line colors are configured in setPlotArea. If not configured, by default, the horizontal grid lines are light grey, and the vertical grid lines are transparent.

For example, if you would like to show both horizontal and vertical grid lines in white color, you may use:

'Use the following line to replace your existing setPlotArea line
Call c.setPlotArea(50, 30, 400, 250, -1, -1, -1, &Hffffff, &Hffffff)

Hope this can help.

Regards
Peter Kwan

  Re: X-Axis grids won't display in productivity bar chart
Posted by Patrick Plummer on Feb-15-2011 11:09
Peter...I did try that beforehand, but I gave it another shot using your exact code...still
will not show those X-AXIS lines...the Yaxis shows fine...here's the code and THANK YOU
ONCE AGAIN FOR YOUR QUICK RESPONSE AND EXPERTISE PETER.

        ' Create a XYChart object of size 500 x 320 pixels
        Dim c As XYChart = New XYChart(175, 250)

     c.addTitle("<*br*>Concentration", "Arial Bold", 10)
     c.addTitle2(Chart.TopCenter,"(Demand / Facil)", "Arial", 8)
    
'c.swapXY()


        ' Set the plotarea at (50, 30) and of size 400 x 250 pixels
'    c.setPlotArea(5, lnPlotHeightStart, 155, lnPlotHeight,-1,-1,&H000080, &H000080)
    c.setPlotArea(5, lnPlotHeightStart, 155, lnPlotHeight,-1,-1,-1, &Hffffff, &Hffffff)

'    c.setPlotArea(5, lnPlotHeightStart, 155, lnPlotHeight).setGridColor(&Hc0c0c0,
&Hc0c0c0, &Hc0c0c0, &Hc0c0c0)




        ' Add a bar layer to the chart using the Overlay data combine method
        Dim layer As BarLayer = c.addBarLayer2(Chart.Overlay)

    'Select positive data and add it as data set with dark green (00AE00) color on light
green back (#F4FFF4)
    layer.addDataSet(New ArrayMath(gAry_Data).selectGEZ(Nothing,
Chart.NoValue).result( ), &HAE00)

    ' Select negative data and add it as data set with orange (ff6600) color
    layer.addDataSet(New ArrayMath(gAry_Data).selectLTZ(Nothing,
Chart.NoValue).result( ), &HFF6600)


    ' Add labels to the top of the bar using 8 pt Arial Bold font. The font color is
    ' configured to be red (0xcc3300) below zero, and green (008000) above zero.

    layer.setAggregateLabelStyle("Arial Bold", 8, layer.yZoneColor(0, &HCC3300, &H8000))

layer.setBarGap(0.2, Chart.TouchBar)

   ' Disable ticks on the x-axis by setting the tick color to transparent
   ' c.xAxis().setTickColor(&H008000)

c.xAxis().setTickLength(2)
c.yAxis().setTickDensity(15)
c.xAxis().setTickDensity(15)


'c.xAxis().setColors(&HDFFFDF)
    'c.yAxis().setColors(&HDFFFDF)



    ' Use Arial Bold as the y axis label font
    c.yAxis().setLabelStyle("Arial")

    ' Add a title to the y axis
    c.yAxis().setTitle(Me.gs_YAxisLabel)

    ' Add a light blue (0xccccff) zone for positive part of the plot area
    c.yAxis().addZone(0, 9999, &HDFFFDF)

    ' Add a pink (0xffffcc) zone for negative part of the plot area
    c.yAxis().addZone(-9999, 0, &HFFCCCC)


'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Re: X-Axis grids won't display in productivity bar chart
Posted by Peter Kwan on Feb-15-2011 11:20
Hi Patrick,

There is no x-axis grid line because there is no x-axis label.

The axis labels and grid line positions may or may not be the same as the data positions. For example, consider the y-axis grid lines. They are not aligned your data. For example, your bars can be at 45, 23, 68, 34, 85 and the grid lines can be at 0, 25, 50, 75, 100. So the existence of the bars do not imply the grid lines at any particular position.

For your case, the bar layer does not use x-coordinates, and the x-axis is not configured with any particular scale (no Axis.setLabels and Axis.setLinearScale). So there is no grid line.

To solve the problem, please put labels on the x-axis. Even empty spaces are OK. For example:

Dim labels(UBound(gAry_Data)) As String
Dim i As Integer
For i = 0 To Ubound(labels) : labels(i) = " ": Next
c.xAxis().setLabels(labels)

Hope this can help.

Regards
Peter Kwan

  Re: X-Axis grids won't display in productivity bar chart
Posted by Patrick on Feb-15-2011 11:33
PETER...THANK YOU FOR your expertise and excellent customer service. I would have NEVER
tried that and you came right up with it. You are brilliant.

I am very appreciative. You are the best.

Thanks again and Happy Valentine's day.  Patrick.