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

Message ListMessage List     Post MessagePost Message

  removing all axis lines while maintaining a set scale on the y axis
Posted by Steve on Aug-21-2013 04:27
Attachments:
Hi,

Using vbscript, I am trying to make all the axis lines transparent.

I am able to achieve this, but only when I do not call:
Call c.yAxis.setLinearScale(min,max)

When setLinearScale or setLinearScale2 is used, I get a line at Y=0.

When I remove this call, I get no lines like intended, but then my y axis is then auto
scaling.

--
code example:
Set c = cd.XYChart(xychartWid, xychartHgt)
Call c.setBorder(&Hff000000)

Call c.setPlotArea(plotArea_left, plotArea_top, plotWid, plotHgt, &Hff000000, &Hff000000,
&Hff000000, &Hff000000, &Hff000000)

Call c.xAxis.setColors(&Hff000000,&H000000)
Call c.yAxis.setColors(&Hff000000,&Hff000000)

Call c.yAxis.setLinearScale(0, 100)  <-- makes the line appear at Y = 0.

...add datasets to stacked bar chart
--

How do I remove that line while keeping the y scaling I want?

with the setLinearScale call (above) without the setLinearScale call (below):
lineAtY=0.png
noLineAtY=0.png

  Re: removing all axis lines while maintaining a set scale on the y axis
Posted by Peter Kwan on Aug-21-2013 23:41
Hi Steve,

I have just tried myself using the following code, and it works normally. No line at y = 0 is
drawn.

For your case, is it possible there are other parts of your code that creates the line at y
= 0? An example is another line that changes the axis color back to the default color
(which is the default line color - black), or a line that called Axis.addMark to add a mark
at y = 0.

If you need further help, is it possible to provide an example with hard coded data (so
that I can use the code to reproduce the problem), perhaps by modifying the code I
included in this messsage?



<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")

' The data for the bar chart
data0 = Array(10.0, 12.5, 24.5, 14.7, 6.7)
data1 = Array(8.5, 15.6, 17.9, 21.1, 12.3)
data2 = Array(9.7, 8.7, 5.6, 26.7, 15.7)

' The labels for the bar chart
labels = Array("Mon", "Tue", "Wed", "Thu", "Fri")

' Create a XYChart object of size 500 x 320 pixels
Set c = cd.XYChart(500, 320)

Call c.setPlotArea(50, 40, 400, 240, cd.Transparent, cd.Transparent, _
cd.Transparent, cd.Transparent, cd.Transparent)

' Add a stacked bar layer and set the layer 3D depth to 8 pixels
Set layer = c.addBarLayer2(cd.Stack)

' Add the three data sets to the bar layer
Call layer.addDataSet(data0, &Hff8080, "Server # 1")
Call layer.addDataSet(data1, &H80ff80, "Server # 2")
Call layer.addDataSet(data2, &H8080ff, "Server # 3")

' Enable bar label for the whole bar
Call layer.setAggregateLabelStyle()

' Enable bar label for each segment of the stacked bar
Call layer.setDataLabelStyle()

Call c.yAxis().setLinearScale(0, 100)
Call c.xAxis().setColors(cd.Transparent, cd.Transparent)
Call c.yAxis().setColors(cd.Transparent, cd.Transparent)

' Output the chart
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>


Regards
Peter Kwan