 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi, Please, check [aiChartsPackage]\Samples\Axes.Customization\DateTimeSample sample from aiCharts package. In general case you need: 1) change aixs value type - ChartAxis.setValueType(ChartAxis.ValueType.Date); 2) (optional) set label format ChartAxis.setLabelFormat(new SimpleDateFormat("HH:mm:ss")); 3) recommended to use ChartSeries.getPoints().addDate() to add points 4) recommended to use ChartAxis.getScale().setDateRange() to specify axis range. Also there is documentation regarding axis labels - http://docs.artfulbits.c...id/guide/axislabels.htmlBest regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
Actually i am having x-axis label format "HH:mm:ss" by string formatter. So i just added to the series like elapsed seconds. And if i set valuetype as date then it coming as default time like 5.30. I need to add my string with the format "HH:mm:ss" to the x-axis. How can i achieve this?
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi,
In what way do you add points?
If you adds points like this
series.getPoints().addXY(1, value1); series.getPoints().addXY(2, value2); series.getPoints().addXY(3, value3);
you add points with interval in 1 millisecond.
Best regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
I will be adding points like
ChartPtCollect.addXY(dummyvalue, yaxis value))).setAxisLabel(TIMER_CLOCK.getText().toString()//my hh:mm:ss formatted string);
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi, ChartPoint.setAxisLabel doesn't work with default label adapter. Default labels adapter uses axis range, interval and label format(ChartAxis.getScale().setRange/setInterval) to gaenerates labels. Other labels adapters doesn't generate labels outside of points. You may implements your own labels adapter if you want - Samples\New.Features\CustomLabelsAdapterSample Using of method getPoints().addXY with ValueTYpe.Date is not right. You should use getPoints().addDate() instead. Otherwise you will add points with interval in 1 millisecond. Docs : http://docs.artfulbits.c...id/guide/axislabels.htmlBest regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi, COuld you please send me sample to create custom adapter with the axis label as "HH:mm:yy" format and with grids always. And also i can't set time from date also as i need to display elapsed time it may be 30hrs or more. Please help me to do this? Edited by user Thursday, December 20, 2012 10:09:46 PM(UTC)
| Reason: Not specified
|
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
I am not able to get the date format as HH:mm:ss. Please help me on this
|
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
Could you please tell me how to create the custom adapter to achieve my requirement?
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi,
Why do you don't want to use method addDate(date, y)? What type of TIMER_CLOCK ?
ChartArea area = new ChartArea(); ChartSeries serie = new ChartSeries();
serie.getPoints().addDate(date1, value1); serie.getPoints().addDate(date2, value2);
area.getDefaultXAxis().setValueType(ValueType.Date);
Anyway, if you want to create custom labelAdapter it's your decision. It's very ease. You just need implement LabelsAdapter interface with single method updateLabels. But you should implement with your specific logic.
|
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
Actually i am getting now the x axis value as 05:30 as default. I just want to replace this with my timer like 00:00:00..00:00:10..00:00:20...etc., With setting smart adapter i am getting properly but without grids. As i dont know the exact implementation of your source code, i just want a adapter class that will solve the grid problem during setRange.
|
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
Actually i am getting now the x axis value as 05:30 as default. I just want to replace this with my timer like 00:00:00..00:00:10..00:00:20...etc., With setting smart adapter i am getting properly but without grids. As i dont know the exact implementation of your source code, i just want a adapter class that will solve the grid problem during setRange.
|
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi, Attached screenshot without setting SmartAdapter. Vinoth attached the following image(s):  Without Smart Adapter.png (84kb) downloaded 36 time(s).You cannot view/download attachments. Try to login or register.
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi,
Yep. It's because you don't set real date value for points and all points is set to 5:30 regarding you time-zone. Use getPoints().addDate or ChartPoint.setDate to set real date value.
Best regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
I am not able to add the string "HH:mm:ss" as a Date object. Please provide me the label adapter class with grid bug solve. Please do help on this.
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi, It's not a bug. You just use it in wrong way. Quote:I am not able to add the string "HH:mm:ss" as a Date object. You just need to understand what you really want to show to your customers. In option I can provide you simple sample of custom labels adapter. Code:class PointsLabelAdapter implements ChartAxis.LabelsAdapter
{
private final ChartSeries mSeries;
public PointsLabelAdapter(ChartSeries series)
{
mSeries = series;
}
@Override
public void updateLabels(ChartAxis axis, List output)
{
ChartAxisScale scale = axis.getScale();
output.clear();
int start = (int) scale.getVisibleMinimum();
int end = (int) scale.getVisibleMaximum();
int step = (int) scale.getVisibleInterval();
for(int p = start; p < end; p += step)
{
String labelText = "";
if(p < mSeries.getPoints().size())
labelText = mSeries.getPoints().get(p).getAxisLabel();
output.add(new Label(labelText, p));
}
}
}
...
chartArea.getDefaultXAxis().setLabelsAdapter(new PointsLabelAdapter(chartSeries));
Best regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
I know the sample adapter class from sample document. But i want to know whether the above code will work for my requirement. If i add the date as my x-axis value then the graph is not smooth and also i am facing some issues and difficulties. So only i am asking you to give me the implementation as you know the full aiChart behavior.
|
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
Could you please provide the required custom class file. I need it urgently. Please help me on this ASAP.
|
|
|
|
 Rank: Member
Groups: Registered
Joined: 7/28/2009(UTC) Posts: 447 
|
Hi,
Provided sample code does what you need, doesn't it?
Best regards, |
Volodymyr Baydalka Andriod development and support team |
|
|
|
 Rank: Advanced Member
Groups: Registered
Joined: 4/25/2012(UTC) Posts: 68 Location: India
|
Hi,
As you mentioned like simple sample for the above code, will it fulfill my requirement?
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.