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

Message ListMessage List     Post MessagePost Message

  xaxis labels and grids
Posted by sophia on Oct-24-2008 21:25
Attachments:
Hello,


My XYChart has multiple lines. Each line has 2000 points. My x-axis from 0 millisecond to 20 millisecond(2000 points). I only want to display the labels as 0,2,4 ....20 ms. For each label I need a grid corresponding to it. I have managed to add the grid. By cant get the label to be displayed. Source code are following.

My questions are:

1) Why I have to put c.layout(); before.
c.xAxis().setLinearScale(0,0.020,0.002); If I dont do it, I wont get xaxis scale at all.

2) c.xAxis().setLabelFormat("{value}"); how come the value doesnt display?

Can anyone help pls? Thanks a lot


XYChart c = new XYChart(CHART_SIZE_X_ENLARGED,CHART_SIZE_Y_ENLARGED);
// set the grid
c.setPlotArea(5,20,PLOT_SIZE_X_ENLARGED,PLOT_SIZE_Y_ENLARGED, 0xffffff, -1, 0xbdbdbe, 0xc2c2c2, 0xc2c2c2);
c.addTitle(frequencyTitle);
c.xAxis().setTitle("ms", "Arial", 8);

c.xAxis().setWidth(1);
c.yAxis().setWidth(1);
c.yAxis().setLabelFormat("");
c.xAxis().setColors(0x000000,0x9e0000,0X000000,0x9e0000);//x label color red, title color black
c.yAxis().setColors(0x000000,0x9e0000,0X000000,0x9e0000);
c.yAxis().setAutoScale(0, 0, 0);

LineLayer layer1 = c.addLineLayer();
layer1.setLineWidth(1);
layer1.setXData(dataX);

//add multiple lines to the layer
for(int l=0; l<dataYArray.length;l++){
layer1.addDataSet(dataYArray[l])
}

//scale the xaxis
c.layout();
c.xAxis().setLinearScale(0,0.020,0.002);
c.xAxis().setLabelFormat("{value}");
enlarged.jpg

  Re: xaxis labels and grids
Posted by sophia on Oct-24-2008 21:45
I have solved the problem. Sorry for the post. My eclipse messed up and gave me all sort of funny diagram.

I only need c.xAxis().setLinearScale(0,20,2); which can indeed put in front of the c.layout()

sorry for the post again!!