Hi,
We are facing issue when trying to plot two series on chart with datetime on X axis(DD-MM-YYYY hh:mm:ss). First series is plotting normally while the second is not. Kindly advise.
Thanks,
Dinesh.
Issue with plotting datetime series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Issue with plotting datetime series
Hi Dinesh,
Could you please give us more detailed information about the exact problem? A simple code snippet on how to reproduce it and an image showing it would be very helpful.
Thanks in advance.
Could you please give us more detailed information about the exact problem? A simple code snippet on how to reproduce it and an image showing it would be very helpful.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Re: Issue with plotting datetime series
Hi Narcís,
We have bought TeeChart for Java V2 recently. Please look into the attached snapshot. In the X-axis we are plotting date and time series, and Y-Axis is the amounts. "Debit" series are plotted properly, but "Credit" is completely wrong. You can see the x-axis values at each node. If I uncheck the "Debit" series, then "Credit" series will be drawn properly. But requirement is both should be viewed at a time.
We are using Series.Add(<<double>>, <<string>>) method to add points. The datetime value at X-axis are in the string value. Kindly advice us to solve the problem.
Best,
Thanks.
We have bought TeeChart for Java V2 recently. Please look into the attached snapshot. In the X-axis we are plotting date and time series, and Y-Axis is the amounts. "Debit" series are plotted properly, but "Credit" is completely wrong. You can see the x-axis values at each node. If I uncheck the "Debit" series, then "Credit" series will be drawn properly. But requirement is both should be viewed at a time.
We are using Series.Add(<<double>>, <<string>>) method to add points. The datetime value at X-axis are in the string value. Kindly advice us to solve the problem.
Best,
Thanks.
- Attachments
-
- pbgraph.JPG (141.82 KiB) Viewed 16120 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Issue with plotting datetime series
Hi SDG,
Thanks for the information.
Hope this helps!
Thanks for the information.
In that case you should use the add(datetime, double, string) or add(datetime, double) methods for populating series.We are using Series.Add(<<double>>, <<string>>) method to add points. The datetime value at X-axis are in the string value.
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Re: Issue with plotting datetime series
Hi Narcís,
Thanks for your reply. This helped us to some extent, but we did not get exact result.
We get the datetime data from a Oracle stored procedure as "01-08-2008 02:16:00". We have used below given code to convert from datetime in the form of string to DateTime object. The datetime displayed at X-axis is still wrong. The format for the X-axis label is "dd-mm-yyyy hh.mm.ss". Kindly advise us.
-----------------------------Code to convert string to datetime object-------------------------------------------------
public DateTime getDateTime(String l_strDateTime){
Calendar calObj = Calendar.getInstance();
StringTokenizer l_strDateTokenizer1 = new StringTokenizer(l_strDateTime," ");
String l_strDate = null;
String l_strTime = null;
while(l_strDateTokenizer1.hasMoreTokens()) {
l_strDate = l_strDateTokenizer1.nextToken();
l_strTime = l_strDateTokenizer1.nextToken();
}
StringTokenizer l_strDateTokenizer2 = new StringTokenizer(l_strDate,"-");
int l_intDay = 0, l_intMonth = 0, l_intYear = 0;
while(l_strDateTokenizer2.hasMoreTokens()) {
l_intDay = Integer.parseInt(l_strDateTokenizer2.nextToken());
l_intMonth = Integer.parseInt(l_strDateTokenizer2.nextToken());
l_intYear = Integer.parseInt(l_strDateTokenizer2.nextToken());
}
StringTokenizer l_strDateTokenizer3 = new StringTokenizer(l_strTime,":");
int l_intHour = 0, l_intMinute = 0, l_intSecond = 0;
while(l_strDateTokenizer2.hasMoreTokens()) {
l_intHour = Integer.parseInt(l_strDateTokenizer3.nextToken());
l_intMinute =Integer.parseInt(l_strDateTokenizer3.nextToken());
l_intSecond = Integer.parseInt(l_strDateTokenizer3.nextToken());
}
calObj.set(l_intYear, l_intMonth, l_intDay, l_intMinute, l_intSecond);
return new DateTime(calObj.getTimeInMillis());
}
------------------------------------------------------------------------------
Best,
Thanks,
Dinesh and Ronad.
Thanks for your reply. This helped us to some extent, but we did not get exact result.
We get the datetime data from a Oracle stored procedure as "01-08-2008 02:16:00". We have used below given code to convert from datetime in the form of string to DateTime object. The datetime displayed at X-axis is still wrong. The format for the X-axis label is "dd-mm-yyyy hh.mm.ss". Kindly advise us.
-----------------------------Code to convert string to datetime object-------------------------------------------------
public DateTime getDateTime(String l_strDateTime){
Calendar calObj = Calendar.getInstance();
StringTokenizer l_strDateTokenizer1 = new StringTokenizer(l_strDateTime," ");
String l_strDate = null;
String l_strTime = null;
while(l_strDateTokenizer1.hasMoreTokens()) {
l_strDate = l_strDateTokenizer1.nextToken();
l_strTime = l_strDateTokenizer1.nextToken();
}
StringTokenizer l_strDateTokenizer2 = new StringTokenizer(l_strDate,"-");
int l_intDay = 0, l_intMonth = 0, l_intYear = 0;
while(l_strDateTokenizer2.hasMoreTokens()) {
l_intDay = Integer.parseInt(l_strDateTokenizer2.nextToken());
l_intMonth = Integer.parseInt(l_strDateTokenizer2.nextToken());
l_intYear = Integer.parseInt(l_strDateTokenizer2.nextToken());
}
StringTokenizer l_strDateTokenizer3 = new StringTokenizer(l_strTime,":");
int l_intHour = 0, l_intMinute = 0, l_intSecond = 0;
while(l_strDateTokenizer2.hasMoreTokens()) {
l_intHour = Integer.parseInt(l_strDateTokenizer3.nextToken());
l_intMinute =Integer.parseInt(l_strDateTokenizer3.nextToken());
l_intSecond = Integer.parseInt(l_strDateTokenizer3.nextToken());
}
calObj.set(l_intYear, l_intMonth, l_intDay, l_intMinute, l_intSecond);
return new DateTime(calObj.getTimeInMillis());
}
------------------------------------------------------------------------------
Best,
Thanks,
Dinesh and Ronad.
- Attachments
-
- pbGraph.JPG (132.01 KiB) Viewed 16122 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Issue with plotting datetime series
Hi Dinesh and Ronad,
Thanks for the information. Could you please attach a simple example project or post a code snippet we can run "as-is" to reproduce the problem here?
Thanks in advance.
Thanks for the information. Could you please attach a simple example project or post a code snippet we can run "as-is" to reproduce the problem here?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |
Re: Issue with plotting datetime series
Hi Narcís,
Please copy TeeChart.Swing.jar in fdmscharts folder and open RightFrame.html to view the sample.
The java code for same is also provided.
Thanks,
Dinesh and Ronad.
Please copy TeeChart.Swing.jar in fdmscharts folder and open RightFrame.html to view the sample.
The java code for same is also provided.
Thanks,
Dinesh and Ronad.
- Attachments
-
- Sample.zip
- (8.38 KiB) Downloaded 990 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Issue with plotting datetime series
Hi Dinesh and Ronad,
Thanks for the example project. Now I understand which is the exact problem. You need to set bottom axis DateTime format as shown below, months being represented by MM as mm means minutes instead of months.
Hope this helps!
Thanks for the example project. Now I understand which is the exact problem. You need to set bottom axis DateTime format as shown below, months being represented by MM as mm means minutes instead of months.
Code: Select all
chart1.getAxes().getBottom().getLabels().setDateTimeFormat("dd-MM-yyyy hh:mm:ss");
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
![]() ![]() ![]() ![]() ![]() ![]() |
Instructions - How to post in this forum |