Page 1 of 1
android axis labels change position (move up)
Posted: Mon Mar 25, 2013 11:06 am
by 17864706
hello,
I need move some labels on bottom axis above the axis line and some labels should stay below. But i didnt found solution, please help.
Or is there some handler for drawing series? because in monotouch-teechart-lib. i found
handler but not in java lib.
Same problem with series Marks, i want
set different arrow length for each mark in series
.
Thanks.
Re: android axis labels change position (move up)
Posted: Tue Mar 26, 2013 4:09 pm
by yeray
Hi,
NIS wrote:I need move some labels on bottom axis above the axis line and some labels should stay below. But i didnt found solution, please help.
Or is there some handler for drawing series? because in monotouch-teechart-lib. i found handler but not in java lib.
What event did you use in TeeChart MonoTouch (now TeeChart .NET for Xamarin.iOS)?
NIS wrote:Same problem with series Marks, i want set different arrow length for each mark in series
.
Have you tried doing something similar to this?
http://www.teechart.net/support/viewtop ... 69&p=42391
Re: android axis labels change position (move up)
Posted: Wed Mar 27, 2013 8:46 am
by 17864706
monotouch solution:
chart.Axes.Bottom.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Bottom_GetAxisDrawLabel);
int count = 0;
void Bottom_GetAxisDrawLabel (object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
{
if ( values [count] > 0.0) {
e.Y = (int)(chart4.Axes.Left.CalcYPosValue(0.0)-8);
}else if ( values [count] < 0.0 || values [count] == 0.0) {
e.Y = (int)(chart4.Axes.Left.CalcYPosValue(0.0)-21);
}
count++;
if(count == values.Count) count = 0;
}
Re: android axis labels change position (move up)
Posted: Wed Mar 27, 2013 12:06 pm
by 17864706
So,
thanks for your help, you solved my problem with marks.
And there is reason why i need move Label over the axis line.
Re: android axis labels change position (move up)
Posted: Wed Mar 27, 2013 12:26 pm
by 17864706
(picture is in post over)
and i noticed that one more small problem is with ticks:
chart.getAxes().getBottom().getTicks().setLength(0);
chart.getAxes().getBottom().getTicks().setColor(Color.white);
chart.getAxes().getBottom().getTicks().setUsesVisible(false);
chart.getAxes().getBottom().getTicks().setVisible(false);
chart.getAxes().getBottom().getTicksInner().setLength(0);
chart.getAxes().getBottom().getTicksInner().setColor(Color.white);
chart.getAxes().getBottom().getTicksInner().setUsesVisible(false);
chart.getAxes().getBottom().getTicksInner().setVisible(false);
-> nothink works
(
but maybe problem can be that i have added into custom labels:
chart.getAxes().getBottom().getCustomLabels().add( 0.0, "12/12" );
)
Re: android axis labels change position (move up)
Posted: Wed Mar 27, 2013 2:30 pm
by yeray
Hi,
The only way I can think to work around this is to hide those labels that correspond to negative values with the AxisLabelResolver. And you could use the same event to manually draw the labels where you want.
Something like this:
Code: Select all
tChart1.setAxisLabelResolver(new AxisLabelAdapter() {
@Override
public String getLabel(Axis axis, ISeries s, int valueIndex, String labelText) {
if (axis == tChart1.getAxes().getBottom()) {
if (valueIndex == -1) {
for (valueIndex=0; valueIndex<tChart1.getSeries(0).getCount(); valueIndex++) {
if (tChart1.getSeries(0).getXValues().getValue(valueIndex) == Double.parseDouble(labelText)) {
if (tChart1.getSeries(0).getYValues().getValue(valueIndex) < 0) {
int x = axis.calcPosValue(tChart1.getSeries(0).getXValues().getValue(valueIndex)) - (tChart1.getGraphics3D().textWidth(labelText) / 2);
int y = tChart1.getChart().getChartRect().getBottom() - 15;
tChart1.getGraphics3D().textOut(x, y, labelText);
return "";
}
}
}
}
}
return labelText;
}
});