Java Code Examples for org.eclipse.draw2d.Graphics#setLineStyle()

The following examples show how to use org.eclipse.draw2d.Graphics#setLineStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinearScaleTickMarks2.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Draw the Y tick marks.
 *
 * @param tickLabelPositions
 *            the tick label positions
 * @param tickLabelSide
 *            the side of tick label relative to tick marks
 * @param width
 *            the width to draw tick marks
 * @param height
 *            the height to draw tick marks
 * @param gc
 *            the graphics context
 */
protected void drawYTickMarks(Graphics gc, List<Integer> tickLabelPositions, LabelSide tickLabelSide, int width,
		int height) {
	// draw tick marks
	gc.setLineStyle(SWTConstants.LINE_SOLID);
	ITicksProvider ticks = getScaleProvider().getTicksProvider();
	if (getScaleProvider().isLogScaleEnabled()) {
		drawMajorTicks(gc, ticks, tickLabelSide, width, height, true);
		if (getScaleProvider().isMinorTicksVisible()) {
			drawMinorTicks(gc, ticks, tickLabelSide, width, height);
		}
	} else {
		drawMajorTicks(gc, ticks, tickLabelSide, width, height, false);
		if (getScaleProvider().isMinorTicksVisible()) {
			drawMinorTicks(gc, ticks, tickLabelSide, width, height);
		}
	}
	// draw scale line
	if (getScaleProvider().isScaleLineVisible()) {
		if (tickLabelSide == LabelSide.Primary) {
			gc.drawLine(width - 1, getScaleProvider().getMargin(), width - 1, height - getScaleProvider().getMargin());
		} else {
			gc.drawLine(0, getScaleProvider().getMargin(), 0, height - getScaleProvider().getMargin());
		}
	}
}
 
Example 2
Source File: PlotArea.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void paintClientArea(final Graphics graphics) {
	super.paintClientArea(graphics);
	if (showBorder) {
		graphics.setLineWidth(2);
		graphics.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
		graphics.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height);
	}
	// Show the start/end cursor or the 'rubberband' of a zoom operation?
	if (armed && end != null && start != null) {
		switch (zoomType) {
		case RUBBERBAND_ZOOM:
		case DYNAMIC_ZOOM:
		case HORIZONTAL_ZOOM:
		case VERTICAL_ZOOM:
			graphics.setLineStyle(SWTConstants.LINE_DOT);
			graphics.setLineWidth(1);
			graphics.setForegroundColor(revertBackColor);
			graphics.drawRectangle(start.x, start.y, end.x - start.x, end.y - start.y);
			break;

		default:
			break;
		}
	}
}
 
Example 3
Source File: Grid.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void paintFigure(Graphics graphics) {
	super.paintFigure(graphics);
	graphics.pushState();
	if (axis.isShowMajorGrid()) {
		graphics.setLineStyle(axis.isDashGridLine() ? SWTConstants.LINE_DASH : SWTConstants.LINE_SOLID);
		graphics.setForegroundColor(axis.getMajorGridColor());
		graphics.setLineWidth(1);
		for (int pos : axis.getScaleTickLabels().getTickLabelPositions()) {
			if (axis.isHorizontal())
				graphics.drawLine(axis.getBounds().x + pos, bounds.y + bounds.height, axis.getBounds().x + pos,
						bounds.y);
			else
				graphics.drawLine(bounds.x, axis.getBounds().y + axis.getBounds().height - pos,
						bounds.x + bounds.width, axis.getBounds().y + axis.getBounds().height - pos);
		}
	}
	graphics.popState();
}
 
Example 4
Source File: ColumnHandle.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void paintFigure( Graphics graphics )
	{
		if ( isSelect( ) )
		{
			graphics.setBackgroundColor( ReportColorConstants.SelctionFillColor );
		}
		else
		{
			graphics.setBackgroundColor( ReportColorConstants.TableGuideFillColor );
		}
		graphics.setLineStyle( SWT.LINE_SOLID );
		Rectangle bounds = getBounds( ).getCopy( );
		graphics.fillRectangle( bounds.resize( -1, -1 ) );
		graphics.setBackgroundColor( ColorConstants.black  );

//		ReportFigureUtilities.paintBevel( graphics,
//				getBounds( ).getCopy( ),
//				true );
	}
 
Example 5
Source File: EditorGuideEditPart.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void paintFigure( Graphics g )
{
	g.setLineStyle( Graphics.LINE_DOT );
	g.setXORMode( true );
	g.setForegroundColor( ColorConstants.darkGray );
	if ( bounds.width > bounds.height )
	{
		g.drawLine( bounds.x, bounds.y, bounds.right( ), bounds.y );
		g.drawLine( bounds.x + 2, bounds.y, bounds.right( ), bounds.y );
	}
	else
	{
		g.drawLine( bounds.x, bounds.y, bounds.x, bounds.bottom( ) );
		g.drawLine( bounds.x, bounds.y + 2, bounds.x, bounds.bottom( ) );
	}
}
 
Example 6
Source File: TimeAxisFigure.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void paintMarkers(Graphics graphics) {

		final Rectangle bounds = getBounds();
		graphics.setForegroundColor(ColorConstants.darkGray);
		graphics.setLineStyle(SWT.LINE_SOLID);

		final Insets insets = RootFigure.getFigure(this, TracksFigure.class).getInsets();
		final ITimelineStyleProvider styleProvider = RootFigure.getRootFigure(this).getStyleProvider();

		final Map<Double, Integer> markerPositions = getDetailFigure().getMarkerPositions();
		for (final Entry<Double, Integer> entry : markerPositions.entrySet()) {
			final String label = styleProvider.getTimeLabel(entry.getKey(), TimeUnit.NANOSECONDS);
			final int textWidth = FigureUtilities.getTextWidth(label, graphics.getFont());

			graphics.drawLine(entry.getValue() + bounds.x() + insets.left, bounds.y, entry.getValue() + bounds.x() + insets.left, bounds.y + 5);
			graphics.drawText(label, (entry.getValue() + bounds.x() + insets.left) - (textWidth / 2), bounds.y + 5);
		}
	}
 
Example 7
Source File: RoundedRectangleBorder.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	tempRect.setBounds(getPaintRectangle(figure, insets));
	if ((getWidth() % 2) == 1) {
		tempRect.width--;
		tempRect.height--;
	}
	tempRect.shrink(getWidth() / 2, getWidth() / 2);

	graphics.setLineWidth(getWidth());
	graphics.setLineStyle(getStyle());
	if (getColor() != null)
		graphics.setForegroundColor(getColor());

	graphics.drawRoundRectangle(tempRect, fArcWidth, fArcHeight);
}
 
Example 8
Source File: LeftRightBorder.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void paint(IFigure figure, Graphics graphics, Insets insets) {
	tempRect.setBounds(getPaintRectangle(figure, insets));
	if ((getWidth() % 2) == 1) {
		tempRect.width--;
		tempRect.height--;
	}
	tempRect.shrink(getWidth() / 2, getWidth() / 2);
	graphics.setLineWidth(getWidth());
	graphics.setLineStyle(getStyle());
	if (getColor() != null)
		graphics.setForegroundColor(getColor());

	graphics.drawLine(tempRect.getTopLeft(), tempRect.getBottomLeft());
	graphics.drawLine(tempRect.getTopRight(), tempRect.getBottomRight());
}
 
Example 9
Source File: CornerHandle.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void paintFigure( Graphics graphics )
	{
		graphics.setBackgroundColor( ReportColorConstants.TableGuideFillColor );
		graphics.setLineStyle( SWT.LINE_SOLID );
		graphics.fillRectangle( getBounds( ).getCopy( ).resize( -1, -1 ) );

//		ReportFigureUtilities.paintBevel( graphics,
//				getBounds( ).getCopy( ),
//				true );

	}
 
Example 10
Source File: EditorDragGuidePolicy.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the Line Figure, when drag the margin guide.
 * 
 * @return
 */
protected IFigure createDummyLineFigure( )
{
	return new Figure( )
	{

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
		 */
		protected void paintFigure( Graphics graphics )
		{
			graphics.setLineStyle( Graphics.LINE_DOT );
			graphics.setXORMode( true );
			graphics.setForegroundColor( ColorConstants.darkGray );
			if ( bounds.width > bounds.height )
			{
				graphics.drawLine( bounds.x, bounds.y, bounds.right( ),
						bounds.y );
				graphics.drawLine( bounds.x + 2, bounds.y, bounds.right( ),
						bounds.y );
			}
			else
			{
				graphics.drawLine( bounds.x, bounds.y, bounds.x, bounds
						.bottom( ) );
				graphics.drawLine( bounds.x, bounds.y + 2, bounds.x, bounds
						.bottom( ) );
			}
		}
	};
}
 
Example 11
Source File: OverviewCursorFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void outlineShape(Graphics graphics) {
	final Rectangle bounds = getBounds();

	graphics.setLineStyle(SWT.LINE_DOT);
	graphics.drawLine(bounds.getTopLeft(), bounds.getBottomLeft());
}
 
Example 12
Source File: GridLayer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void paintGrid(Graphics graphics) {
	final ITimelineStyleProvider styleProvider = RootFigure.getRootFigure(this).getStyleProvider();
	graphics.setLineStyle(styleProvider.getGridLineStyle());

	final Rectangle bounds = getBounds();
	final Map<Double, Integer> markerPositions = RootFigure.getFigure(this, DetailFigure.class).getMarkerPositions();
	for (final int position : markerPositions.values())
		graphics.drawLine(position + bounds.x(), bounds.y, position + bounds.x(), bounds.y + bounds.height);
}
 
Example 13
Source File: ListBandRenderFigure.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected void paintFigure( Graphics graphics )
{
	graphics.setForegroundColor( ReportColorConstants.ShadowLineColor );
	graphics.setLineStyle( SWT.LINE_SOLID );
	graphics.drawRectangle( getBounds( ).getCopy( ).shrink( 2, 2 ) );
}
 
Example 14
Source File: RootDragTracker.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
 */
protected void paintFigure( Graphics graphics )
{
	Rectangle bounds = getBounds( ).getCopy( );
	graphics.translate( getLocation( ) );

	graphics.setXORMode( true );
	graphics.setForegroundColor( ColorConstants.white );
	graphics.setBackgroundColor( ColorConstants.black );

	graphics.setLineStyle( Graphics.LINE_DOT );

	int[] points = new int[6];

	points[0] = 0 + offset;
	points[1] = 0;
	points[2] = bounds.width - 1;
	points[3] = 0;
	points[4] = bounds.width - 1;
	points[5] = bounds.height - 1;

	graphics.drawPolyline( points );

	points[0] = 0;
	points[1] = 0 + offset;
	points[2] = 0;
	points[3] = bounds.height - 1;
	points[4] = bounds.width - 1;
	points[5] = bounds.height - 1;

	graphics.drawPolyline( points );

	graphics.translate( getLocation( ).getNegated( ) );

	if ( schedulePaint )
	{
		Display.getCurrent( ).timerExec( DELAY, new Runnable( ) {

			public void run( )
			{
				offset++;
				if ( offset > 5 )
					offset = 0;

				schedulePaint = true;
				repaint( );
			}
		} );
	}

	schedulePaint = false;
}
 
Example 15
Source File: CustomRubberbandDragTracker.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
 */
protected void paintFigure(Graphics graphics) {	
	Rectangle bounds1 = getBounds().getCopy();
	graphics.translate(getLocation());

	graphics.setXORMode(false);
	graphics.setForegroundColor(ColorConstants.black);
	graphics.setBackgroundColor(ColorConstants.black);

	//graphics.drawRectangle(bounds1) ;

	graphics.setLineStyle(Graphics.LINE_DOT);

	int[] points = new int[6];

	points[0] = 0 + offset;
	points[1] = 0;
	points[2] = bounds1.width - 1;
	points[3] = 0;
	points[4] = bounds1.width - 1;
	points[5] = bounds1.height - 1;

	graphics.drawPolyline(points);

	points[0] = 0;
	points[1] = 0 + offset;
	points[2] = 0;
	points[3] = bounds1.height - 1;
	points[4] = bounds1.width - 1;
	points[5] = bounds1.height - 1;

	graphics.drawPolyline(points);

	graphics.translate(getLocation().getNegated());

	if (schedulePaint) {
		Display.getCurrent().timerExec(DELAY, new Runnable() {
			public void run() {
				offset++;
				if (offset > 5)
					offset = 0;	

				schedulePaint = true;
				repaint();
			}
		});
	}

	schedulePaint = false;
}
 
Example 16
Source File: CellDragTracker.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
 */
protected void paintFigure( Graphics graphics )
{
	Rectangle bounds = getBounds( ).getCopy( );
	graphics.translate( getLocation( ) );

	graphics.setXORMode( true );
	graphics.setForegroundColor( ColorConstants.white );
	graphics.setBackgroundColor( ColorConstants.black );

	graphics.setLineStyle( Graphics.LINE_DOT );

	int[] points = new int[6];

	points[0] = 0 + offset;
	points[1] = 0;
	points[2] = bounds.width - 1;
	points[3] = 0;
	points[4] = bounds.width - 1;
	points[5] = bounds.height - 1;

	graphics.drawPolyline( points );

	points[0] = 0;
	points[1] = 0 + offset;
	points[2] = 0;
	points[3] = bounds.height - 1;
	points[4] = bounds.width - 1;
	points[5] = bounds.height - 1;

	graphics.drawPolyline( points );

	graphics.translate( getLocation( ).getNegated( ) );

	if ( schedulePaint )
	{
		Display.getCurrent( ).timerExec( DELAY, new Runnable( ) {

			public void run( )
			{
				offset++;
				if ( offset > 5 )
					offset = 0;

				schedulePaint = true;
				repaint( );
			}
		} );
	}

	schedulePaint = false;
}
 
Example 17
Source File: Trace.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Draw line with the line style and line width of the trace.
 * 
 * @param graphics
 * @param p1
 * @param p2
 */
public void drawLine(Graphics graphics, Point p1, Point p2) {
	graphics.pushState();
	graphics.setLineWidth(lineWidth);
	switch (traceType) {
	case SOLID_LINE:
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawLine(p1, p2);
		break;
	case BAR:
		if (use_advanced_graphics)
			graphics.setAlpha(areaAlpha);
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawLine(p1, p2);
		break;
	case DASH_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DASH);
		graphics.drawLine(p1, p2);
		break;
	case DASHDOT_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DASHDOT);
		graphics.drawLine(p1, p2);
		break;
	case DASHDOTDOT_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DASHDOTDOT);
		graphics.drawLine(p1, p2);
		break;
	case DOT_LINE:
		graphics.setLineStyle(SWTConstants.LINE_DOT);
		graphics.drawLine(p1, p2);
		break;
	case AREA:
	case LINE_AREA:
		if (traceType == TraceType.LINE_AREA) {
			graphics.setLineStyle(SWTConstants.LINE_SOLID);
			graphics.drawLine(p1, p2);
		}
		int basey;
		switch (baseLine) {
		case NEGATIVE_INFINITY:
			basey = yAxis.getValuePosition(yAxis.getRange().getLower(), false);
			break;
		case POSITIVE_INFINITY:
			basey = yAxis.getValuePosition(yAxis.getRange().getUpper(), false);
			break;
		default:
			basey = yAxis.getValuePosition(0, false);
			break;
		}
		if (use_advanced_graphics)
			graphics.setAlpha(areaAlpha);
		graphics.setBackgroundColor(traceColor);
		graphics.fillPolygon(new int[] { p1.x, p1.y, p1.x, basey, p2.x, basey, p2.x, p2.y });
		break;
	case STEP_HORIZONTALLY:
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawLine(p1.x, p1.y, p2.x, p1.y);
		graphics.drawLine(p2.x, p1.y, p2.x, p2.y);
		break;
	case STEP_VERTICALLY:
		graphics.setLineStyle(SWTConstants.LINE_SOLID);
		graphics.drawLine(p1.x, p1.y, p1.x, p2.y);
		graphics.drawLine(p1.x, p2.y, p2.x, p2.y);
		break;

	default:
		break;
	}
	graphics.popState();
}
 
Example 18
Source File: Trace.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private void drawPoint(Graphics graphics, Point pos, ISample sample) {
	Color renderColor = traceColor;
	PointStyle renderPointStyle = pointStyle;
	int renderPointSize = pointSize;
	try {
		if ((fPointStyleProvider != null) && (sample != null)) {
			renderColor = fPointStyleProvider.getPointColor(sample, this);
			renderPointStyle = fPointStyleProvider.getPointStyle(sample, this);
			renderPointSize = fPointStyleProvider.getPointSize(sample, this);
		}
	} catch (Exception ex) {
		// Draw anyway and log error
		System.err.println(ex.getMessage());
		renderColor = traceColor;
		renderPointStyle = pointStyle;
		renderPointSize = pointSize;
	}
	// Shortcut when no point requested
	if (renderPointStyle == PointStyle.NONE) {
		return;
	}
	graphics.pushState();
	graphics.setBackgroundColor(renderColor);
	graphics.setForegroundColor(renderColor); // Otherwise redraw does not
												// affect lines
	graphics.setLineWidth(1);
	graphics.setLineStyle(SWTConstants.LINE_SOLID);
	int halfSize = renderPointSize / 2;
	switch (renderPointStyle) {
	case POINT:
		graphics.fillOval(new Rectangle(pos.x - halfSize, pos.y - halfSize, renderPointSize, renderPointSize));
		break;
	case CIRCLE:
		graphics.drawOval(new Rectangle(pos.x - halfSize, pos.y - halfSize, renderPointSize, renderPointSize));
		break;
	case FILLED_CIRCLE:
		graphics.fillOval(new Rectangle(pos.x - halfSize, pos.y - halfSize, renderPointSize, renderPointSize));
		break;
	case TRIANGLE:
		graphics.drawPolygon(new int[] { pos.x - halfSize, pos.y + halfSize, pos.x, pos.y - halfSize,
				pos.x + halfSize, pos.y + halfSize });
		break;
	case FILLED_TRIANGLE:
		graphics.fillPolygon(new int[] { pos.x - halfSize, pos.y + halfSize, pos.x, pos.y - halfSize,
				pos.x + halfSize, pos.y + halfSize });
		break;
	case SQUARE:
		graphics.drawRectangle(new Rectangle(pos.x - halfSize, pos.y - halfSize, renderPointSize, renderPointSize));
		break;
	case FILLED_SQUARE:
		graphics.fillRectangle(new Rectangle(pos.x - halfSize, pos.y - halfSize, renderPointSize, renderPointSize));
		break;
	case BAR:
		graphics.drawLine(pos.x, pos.y - halfSize, pos.x, pos.y + halfSize);
		break;
	case CROSS:
		graphics.drawLine(pos.x, pos.y - halfSize, pos.x, pos.y + halfSize);
		graphics.drawLine(pos.x - halfSize, pos.y, pos.x + halfSize, pos.y);
		break;
	case XCROSS:
		graphics.drawLine(pos.x - halfSize, pos.y - halfSize, pos.x + halfSize, pos.y + halfSize);
		graphics.drawLine(pos.x + halfSize, pos.y - halfSize, pos.x - halfSize, pos.y + halfSize);
		break;
	case DIAMOND:
		graphics.drawPolyline(new int[] { pos.x, pos.y - halfSize, pos.x - halfSize, pos.y,
				pos.x, pos.y + halfSize, pos.x + halfSize, pos.y, pos.x, pos.y - halfSize });
		break;
	case FILLED_DIAMOND:
		graphics.fillPolygon(new int[] { pos.x, pos.y - halfSize, pos.x - halfSize, pos.y,
				pos.x, pos.y + halfSize, pos.x + halfSize, pos.y });
		break;
	default:
		break;
	}
	graphics.popState();
}
 
Example 19
Source File: Axis.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void paintClientArea(final Graphics graphics) {
	// Don't do anything when hidden
	if (!isVisible())
		return;

	super.paintClientArea(graphics);

	// graphics.pushState();
	if (title != null) {
		graphics.setFont(titleFont);
		final Dimension titleSize = FigureUtilities.getTextExtents(title, titleFont);
		if (isHorizontal()) {
			if (getTickLabelSide() == LabelSide.Primary)
				graphics.drawText(title, bounds.x + bounds.width / 2 - titleSize.width / 2,
						bounds.y + bounds.height - titleSize.height);
			else
				graphics.drawText(title, bounds.x + bounds.width / 2 - titleSize.width / 2, bounds.y);
		} else {
			final int w = titleSize.height;
			final int h = titleSize.width + 1;

			if (getTickLabelSide() == LabelSide.Primary) {
				GraphicsUtil.drawVerticalText(graphics, title, bounds.x, bounds.y + bounds.height / 2 - h / 2,
						false);
			} else {
				GraphicsUtil.drawVerticalText(graphics, title, bounds.x + bounds.width - w,
						bounds.y + bounds.height / 2 - h / 2, true);
			}
		}
	}
	// graphics.popState();

	// Show the start/end cursor or the 'rubberband' of a zoom operation?
	if (armed && end != null && start != null) {
		switch (zoomType) {
		case RUBBERBAND_ZOOM:
		case HORIZONTAL_ZOOM:
		case VERTICAL_ZOOM:
		case DYNAMIC_ZOOM:
			graphics.setLineStyle(SWTConstants.LINE_DOT);
			graphics.setLineWidth(1);
			graphics.setForegroundColor(revertBackColor);
			graphics.drawRectangle(start.x, start.y, end.x - start.x - 1, end.y - start.y - 1);
			break;

		default:
			break;
		}
	}
}
 
Example 20
Source File: LinearScaleTickMarks.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Draw the Y tick marks.
 * 
 * @param tickLabelPositions
 *            the tick label positions
 * @param tickLabelSide
 *            the side of tick label relative to tick marks
 * @param width
 *            the width to draw tick marks
 * @param height
 *            the height to draw tick marks
 * @param gc
 *            the graphics context
 */
protected void drawYTickMarks(Graphics gc, List<Integer> tickLabelPositions, LabelSide tickLabelSide, int width,
		int height) {
	updateMinorTickParas();
	// draw tick marks
	gc.setLineStyle(SWTConstants.LINE_SOLID);
	int x = 0;
	int y = 0;
	if (scale.isLogScaleEnabled()) {
		ArrayList<Boolean> tickLabelVisibilities = scale.getScaleTickLabels().getTickVisibilities();
		for (int i = 0; i < tickLabelPositions.size(); i++) {

			int tickLength = 0;
			if (tickLabelVisibilities.get(i))
				tickLength = MAJOR_TICK_LENGTH;
			else
				tickLength = MINOR_TICK_LENGTH;

			if (tickLabelSide == LabelSide.Primary) {
				x = width - 1 - LINE_WIDTH - tickLength;
			} else {
				x = LINE_WIDTH;
			}
			y = height - tickLabelPositions.get(i);
			if (tickLabelVisibilities.get(i) || scale.isMinorTicksVisible())
				gc.drawLine(x, y, x + tickLength, y);
		}
	} else {
		for (int i = 0; i < tickLabelPositions.size(); i++) {
			if (tickLabelSide == LabelSide.Primary) {
				x = width - 1 - LINE_WIDTH - MAJOR_TICK_LENGTH;
			} else {
				x = LINE_WIDTH;
			}
			y = height - tickLabelPositions.get(i);
			gc.drawLine(x, y, x + MAJOR_TICK_LENGTH, y);
			// draw minor ticks for linear scale
			if (scale.isMinorTicksVisible()) {
				if (i > 0) {
					// draw the first grid step which is start from min
					// value
					if (i == 1 && (tickLabelPositions.get(1) - tickLabelPositions.get(0)) < scale
							.getScaleTickLabels().getGridStepInPixel()) {
						y = tickLabelPositions.get(1);
						while ((y - tickLabelPositions.get(0)) > minorGridStepInPixel + 3) {
							y = y - minorGridStepInPixel;
							drawYMinorTicks(gc, tickLabelSide, x, height - y);
						}
					} // draw the last grid step which is end to max value
					else if (i == tickLabelPositions.size() - 1
							&& (tickLabelPositions.get(i) - tickLabelPositions.get(i - 1)) < scale
									.getScaleTickLabels().getGridStepInPixel()) {
						y = tickLabelPositions.get(i - 1);
						while ((tickLabelPositions.get(i) - y) > minorGridStepInPixel + 3) {
							y = y + minorGridStepInPixel;
							drawYMinorTicks(gc, tickLabelSide, x, height - y);
						}
					} else { // draw regular steps
						for (int j = 0; j < minorTicksNumber; j++) {
							y = height - tickLabelPositions.get(i - 1)
									- (tickLabelPositions.get(i) - tickLabelPositions.get(i - 1)) * j
											/ minorTicksNumber;
							drawYMinorTicks(gc, tickLabelSide, x, y);
						}
					}
				}
			}
		}
	}

	// draw scale line
	if (scale.isScaleLineVisible()) {
		if (tickLabelSide == LabelSide.Primary) {
			gc.drawLine(width - 1, scale.getMargin(), width - 1, height - scale.getMargin());
		} else {
			gc.drawLine(0, scale.getMargin(), 0, height - scale.getMargin());
		}
	}

}