l = (i == _gridZeroIndex) ? _lineWidth : k;
if (_valuesFirst) {
g2.drawLine(o1 - _defaultTickLength, _gridPos[i], o1,
_gridPos[i]);
if (l > 0) {
Stroke s = g2.getStroke();
Color c = g2.getColor();
if (i != _gridZeroIndex)
g2.setStroke(_gridStroke);
g2.setColor(gridColor);
g2.drawLine(o1, _gridPos[i], o1 + l, _gridPos[i]);
g2.setColor(c);
g2.setStroke(s);
}
} else {
g2.drawLine(o1 + _defaultTickLength, _gridPos[i], o1,
_gridPos[i]);
if (l > 0) {
Stroke s = g2.getStroke();
Color c = g2.getColor();
if (i != _gridZeroIndex)
g2.setStroke(_gridStroke);
g2.setColor(gridColor);
g2.drawLine(o1, _gridPos[i], o1 - l, _gridPos[i]);
g2.setColor(c);
g2.setStroke(s);
}
}
}
} else {
k = _withGridlines ? _lineHeight : 0;
if (_valuesFirst) {
o1 = _oy;
} else {
o1 = _oy - _lineHeight;
}
if (_withAxis){
g2.drawLine(_ox, o1, _ox + _lineWidth, o1);
}
for (int i = 0; i < _gridValues.length; i++) {
l = (i == _gridZeroIndex) ? _lineHeight : k;
int labelShift=0;
if(_nbrLabelLines>0){
labelShift= (i%_nbrLabelLines)*_labelLineHeight;
}
if (_valuesFirst) {
g2.drawLine(_gridPos[i], o1 + _defaultTickLength + labelShift,
_gridPos[i], o1);
if (l > 0) {
Stroke s = g2.getStroke();
Color c = g2.getColor();
if (i != _gridZeroIndex)
g2.setStroke(_gridStroke);
g2.setColor(gridColor);
g2.drawLine(_gridPos[i], o1, _gridPos[i], o1 - l);
g2.setColor(c);
g2.setStroke(s);
}
} else {
g2.drawLine(_gridPos[i], o1 - _defaultTickLength - labelShift,
_gridPos[i], o1);
if (l > 0) {
Stroke s = g2.getStroke();
Color c = g2.getColor();
if (i != _gridZeroIndex)
g2.setStroke(_gridStroke);
g2.setColor(gridColor);
g2.drawLine(_gridPos[i], o1, _gridPos[i], o1 + l);