use of org.swtchart.IAxis.Position in project netxms by netxms.
the class ChartLayout method computeControlSize.
/**
* Computes the size of child controls.
*/
private void computeControlSize() {
titleWidth = ((ChartLayoutData) title.getLayoutData()).widthHint;
titleHeight = ((ChartLayoutData) title.getLayoutData()).heightHint;
legendWidth = ((ChartLayoutData) legend.getLayoutData()).widthHint;
legendHeight = ((ChartLayoutData) legend.getLayoutData()).heightHint;
for (Axis axis : axes) {
AxisLayoutData layoutData = new AxisLayoutData(axis);
if (layoutData.titleLayoutdata == null || layoutData.tickLabelsLayoutdata == null || layoutData.tickMarksLayoutdata == null) {
continue;
}
Position position = axis.getPosition();
if (position == Position.Primary && axis.isHorizontalAxis()) {
bottomAxisHeight += layoutData.titleLayoutdata.heightHint + layoutData.tickLabelsLayoutdata.heightHint + layoutData.tickMarksLayoutdata.heightHint;
} else if (position == Position.Secondary && axis.isHorizontalAxis()) {
topAxisHeight += layoutData.titleLayoutdata.heightHint + layoutData.tickLabelsLayoutdata.heightHint + layoutData.tickMarksLayoutdata.heightHint;
} else if (position == Position.Primary && !axis.isHorizontalAxis()) {
leftAxisWidth += layoutData.titleLayoutdata.widthHint + layoutData.tickLabelsLayoutdata.widthHint + layoutData.tickMarksLayoutdata.widthHint;
} else if (position == Position.Secondary && !axis.isHorizontalAxis()) {
rightAxisWidth += layoutData.titleLayoutdata.widthHint + layoutData.tickLabelsLayoutdata.widthHint + layoutData.tickMarksLayoutdata.widthHint;
}
}
}
use of org.swtchart.IAxis.Position in project netxms by netxms.
the class ChartLayout method layoutAxes.
/**
* Layouts the axes.
*
* @param r the rectangle to layout
*/
private void layoutAxes(Rectangle r) {
bottomAxisOffset = 0;
topAxisOffset = 0;
leftAxisOffset = 0;
rightAxisOffset = 0;
for (Axis axis : axes) {
AxisLayoutData layoutData = new AxisLayoutData(axis);
if (layoutData.titleLayoutdata == null || layoutData.tickLabelsLayoutdata == null || layoutData.tickMarksLayoutdata == null) {
continue;
}
Position position = axis.getPosition();
if (position == Position.Primary && axis.isHorizontalAxis()) {
layoutBottomAxis(r, layoutData);
} else if (position == Position.Secondary && axis.isHorizontalAxis()) {
layoutTopAxis(r, layoutData);
} else if (position == Position.Primary && !axis.isHorizontalAxis()) {
layoutLeftAxis(r, layoutData);
} else if (position == Position.Secondary && !axis.isHorizontalAxis()) {
layoutRightAxis(r, layoutData);
}
}
}
use of org.swtchart.IAxis.Position in project netxms by netxms.
the class AxisTick method getBounds.
/*
* @see IAxisTick#getBounds()
*/
public Rectangle getBounds() {
Rectangle r1 = axisTickMarks.getBounds();
Rectangle r2 = axisTickLabels.getBounds();
Position position = axis.getPosition();
if (position == Position.Primary && axis.isHorizontalAxis()) {
return new Rectangle(r1.x, r1.y, r1.width, r1.height + r2.height);
} else if (position == Position.Secondary && axis.isHorizontalAxis()) {
return new Rectangle(r1.x, r2.y, r1.width, r1.height + r2.height);
} else if (position == Position.Primary && !axis.isHorizontalAxis()) {
return new Rectangle(r2.x, r1.y, r1.width + r2.width, r1.height);
} else if (position == Position.Secondary && !axis.isHorizontalAxis()) {
return new Rectangle(r1.x, r1.y, r1.width + r2.width, r1.height);
} else {
throw new IllegalStateException("unknown axis position");
}
}