yunjianwu / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

Custom axis labels: Missing functionality, interface confusion. #472

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Based on nightly build Jan 31, 2015.

- Present interface

SHOW/HIDE AUTO GRID 
setShowGrid(boolean) // X and Y
setShowGridX(boolean) // X only
setShowGridY(boolean) // Y only

SHOW/HIDE CUSTOM GRID 
setShowCustomTextGrid(boolean) // X and Y
setShowCustomTextGridX(boolean) // X only
setShowCustomTextGridY(boolean) // Y only

SHOW/HIDE AUTO AXIS LABEL 
setShowLabels(boolean) // X and Y, affects all, custom too!
// No singular X/Y.

SHOW/HIDE CUSTOM AXIS LABEL 
// None, stuck with above.

- Problems

(1) Major.

Cannot toggle custom labels only.
Cannot toggle X and Y labels separately.

Discussion: If using custom labels, ask question why? Good chance user does not 
want auto labels if using custom. 

I have a descending Y axis which requires custom labels. If use undocumented 
high-min/low-max approach custom labels do not show (bug?). If use custom 
labels and transform data (easy) then are forced to show auto labels with my 
custom labels - one descending the other ascending!

(2) Minor

Inconsistent naming: TextLabel vs CustomText. X before vs X after (less 
important)
e.g.
labels: addXTextLabel(), clearXTextLabels(), removeXTextLabel()
grid: setShowCustomTextGridX()

NB. Custom text labels can be numeric, therefore "CustomLabel" better (doesn't 
imply alphabetic)? But have CustomText in grid methods...

Better: addCustomLabelX(), clearCustomLabelsX(), removeCustomLabel()

- Advised best solution, ignores backward compatibility

SHOW/HIDE AUTO GRID - No Change
setShowGrid(boolean)
setShowGridX(boolean)
setShowGridY(boolean)

SHOW/HIDE CUSTOM GRID - Name change only
setShowCustomLabelGrid(boolean)
setShowCustomLabelGridX(boolean
setShowCustomLabelGridY(boolean)

SHOW/HIDE AUTO AXIS LABEL - Affects auto labels only. Add new X and Y specific. 
setShowLabels(boolean)
setShowLabelsX(boolean)
setShowLabelsY(boolean)

SHOW/HIDE CUSTOM AXIS LABEL - All new. 
setShowCustomLabels(boolean)
setShowCustomLabelsX(boolean)
setShowCustomLabelsY(boolean)

For others always use CustomLabel to indicate custom text/label e.g. 
addCustomLabelX(), clearCustomLabelsX(), removeCustomLabel().

- Advised compromise solution, backwards compatible (99% !)

SHOW/HIDE AUTO GRID - No change
setShowGrid(boolean)
setShowGridX(boolean)
setShowGridY(boolean)

SHOW/HIDE CUSTOM GRID - No Change
setShowCustomTextGrid(boolean)
setShowCustomTextGridX(boolean)
setShowCustomTextGridY(boolean)

SHOW/HIDE AUTO AXIS LABEL - Affects auto labels only. Add new X and Y specific. 
setShowLabels(boolean) // Functional change, breaks compatibility? *
setShowLabelsX(boolean) 
setShowLabelsY(boolean)

* Or does it? If user isn't showing any labels then wouldn't add custom labels.

SHOW/HIDE CUSTOM AXIS LABEL - All new (Naming? Align with setShowCustomTextGrid 
or addXTextLabel?)
setShowCustomLabels(boolean)
setShowCustomLabelsX(boolean)
setShowCustomLabelsY(boolean)

- Thinking bigger

Do mass general interface clean-up e.g. 'Best' solution above, and others?
Release under new namespace.

Original issue reported on code.google.com by harrycal...@gmail.com on 1 Feb 2015 at 3:20

GoogleCodeExporter commented 9 years ago
Was thinking more about this: is it simply a bug that setShowLabels(boolean) 
can disable custom labels? As stated previously, if user doesn't want custom 
labels they can simply not add them.

Or did someone want custom grid lines but not labels? Surely they can just add 
blank as the label.

While the new methods described above are ideal, at the moment I could live 
with simply stopping setShowLabels() from affecting custom labels. I will 
disable all auto labels and add custom for both X and Y.

Original comment by harrycal...@gmail.com on 2 Feb 2015 at 1:21