Page 1 of 1

[Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Wed Jul 11, 2012 10:05 am
by 16962897
Hi! I am using TeeChart for android.
I am setting the scale of the x-Axis to DateTime
bottomChart.getAxes().getBottom().setIncrement(Utils.getDateTimeStep(DateTimeStep.ONEDAY));
bottomChart.getAxes().getBottom().getLabels().setDateTimeFormat("dd.MM.yyyy");

But i only wanna show the time range for a 7-days-chart from 9.00am to 6.00pm for each day, not 24 hours
same problem when i a using DateTimeStep.ONEMONTH or ONEWEEK

How i solve it? I cannot find a example.

Thanks for ur help!

Michael

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Thu Jul 12, 2012 11:09 am
by yeray
Hi Michael,

I'm not sure to understand what do you exactly mean. However, I guess it should be possible to use the getLabel event (through the Chat's AxisLabelResolver) to format or hide (setting an empty string) the desired axis labels.

If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Thu Jul 12, 2012 12:23 pm
by 16962897
The documentation of AxisLabelResolver is not the best. Do u have an example how to use it?

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Thu Jul 12, 2012 1:15 pm
by 16962897
Ok i cannot send u the project but with a picture u will findout what i what to achieve

This a week chart with a Daystep as increment
week.png
week.png (30.51 KiB) Viewed 16055 times
But i wanna display the chart only from 9am to 6pm
For example here:
week1.png
week1.png (32.51 KiB) Viewed 16056 times
The solution would be the chart without the orange gaps.
Any idea?

Thanks for ur help

Michael

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Thu Jul 12, 2012 2:32 pm
by yeray
Hi Michael,
micha wrote:The documentation of AxisLabelResolver is not the best. Do u have an example how to use it?
Here you have it:

Code: Select all

		tChart1.setAxisLabelResolver(new AxisLabelResolver() {
			
			@Override
			public void scrollModHandler(Axis a, ScrollModEventArgs e) { }
			
			@Override
			public NextAxisLabelValue getNextLabel(Axis axis, int labelIndex, NextAxisLabelValue nextLabel) {
				return nextLabel;
			}
			
			@Override
			public String getLabel(Axis axis, ISeries s, int valueIndex, String labelText) {
				if (axis == tChart1.getAxes().getBottom()) {
					//modify labelText when needed
				}
				return labelText;
			}
		});
micha wrote:The solution would be the chart without the orange gaps.
Any idea?
It sound pretty much what Axis Break tool does. Please, take a look at the example at "What's new?\Welcome!\New Chart tools\Axis breaks" in the features demo included with the TeeChart Java installation (desktop version). If you only have the TeeChart Java for Android version, you can download the TeeChart Java evaluation version to see the examples the desktop version includes.

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Mon Jul 16, 2012 6:16 am
by 16962897
ok thanks the Axis Break tool seems to be the solution.
But one more question. How can i prevent the overlapping of axis label when i use the axis break tool?

Thanks again.

Re: [Teechart Android]show X-Axis each day only from 9am to 6pm?

Posted: Mon Jul 16, 2012 11:33 am
by narcis
Hi micha,

Can you please attach a simple example project we can run "as-is" to reproduce the problem here? A general option could be using custom axis labels as in the examples at the All Features\Welcome!\Axes\Labels section in the TeeChart.Features.jar demo.