I would like to create a graph using data from a database (Oracle).
The dataset contains DateTimeStamp values and numeric values
The DateTimeStamp values are for intervals of 15 minutes and usually extend for a period greater than one calendar day.
The DateTimeStamp values need to be graphed against the X-axis and the data values (numeric) will be graphed against the Y-yxis.
The x-axis major tic marks should be the calendar days.
I have purchased the enterprise version of JFreeChart but the username password provided does not allow me to ask questions on their forum, and sending email to the owner results in no response.
Thanks for any help you can offer. A working code block/snippet would be ideal and much appreciated.
Look at JDBCXYDataset, which uses the query's ResultSetMetaData to recognize Types related to date and time. Complete examples are seen here and here.
As an aside, access to the support forum is free; just click the register link.
Related
I'm creating a sqlite database from my c# project which will be used in my android application later on.
I have a CreateDate column in my sqlite database which I will need to get records ordered by this column later in my android application. Now my question is that is it better to save the date time as TEXT with YYYY-MM-DD HH:MM:SS format or I just convert all my dates into miliseconds and order them easily later since it's just a number?
Which one is easier to be ordered later in mobile application? or maybe my approaches are wrong so please feel free to shoot me with some best practices for this situation.
Thanks in advance.
Well unix timestamp looks simple and easier but i wont recommend you this.
Check out this gif.
What happens on January 19, 2038?
On this date the Unix Time Stamp will cease to work due to a 32-bit overflow. Before this moment millions of applications will need to either adopt a new convention for time stamps or be migrated to 64-bit systems which will buy the time stamp a "bit" more time.
Therefore i would suggest you to stick with YYYY-MM-DD HH:MM:SS format as it is both C# and Android compatible(or parseable i should say) and neither would string overflow in near future ;)
Good Luck.
I have to display data in Listview in android. For that I am retrieving data from sqlite database, having two column fields "date" and "amount". There are some more column fields but i don't need them. Now I want to show data in Listview weekly basis, with addition of the amount for the given week. Can anyone Please help me. How can I do this.(I thought of using strftime() function also but it add all the previous weeks data in one row. even thought for using Calendar class of java but don't know how can I achieve the solution using that.)
If I understand correctly your only problem is to make sure that a week has passed. If so:
I refer you to this solution: (Java / Android) Calculate days between 2 dates and present the result in a specific format , that uses no external Java libraries. You can just save the former list population day, the current day, and use the solution here to get the distance between them in days. Then all that remains is to check if the result >= 7. if so, a week has passed.
JasperReports newbie here. I have read the tutorial and the quick reference and read up on a number of articles regarding JR, and have now been playing around with the iReport report designer for a day or so.
I think the last major set of concepts I am choking on have to do with the relationship between chart components and their data. Although it is easy to find definitions for each of these, there seems to be very little practicle documentation showing how they relate to one another in a meaningful application.
Report Fields
Report Prameters
Report Variables
Datasets
By playing around with iReport it seems that Fields, Parameters and Variables can exist at the report-level, as well as being placed inside of Datasets. But my understanding of when something is a Field vs. Parameter vs. Variable is very fuzzy, and my understanding of how they relate to Datasets is also very shaky.
Using Datasets as a slight segue, I'm having a tough time seeing the "forest through the trees" with how chart components (such as pie charts, tabls, etc.) get "fed" or "injected with" their data.
Soo... I thought of an example that, if answered, would tie everything together for me (I believe!). Let's say I had two chart components, a text field and a pie chart. I want the pie chart to appear below the text field like so:
The author of this report is: <value supplied by the data source>
<pie chart here>
So, at "fill time" (I think I'm using that correctly...), the report will be "filled" with the name of the report's author (a String), as well as a pie chart comprised of 2 pie slices: 1 slice with a value of 75 with a label/key of "Eloi" and a 2nd slice with a value of 25 and a label/key of "Morlocks". If I am not using the correct JR terminology here, what I am trying to achieve is a fill-time pie chart with two slices: an "Eloi" slice consuming 75% of the chart, and a "Morlocks" slice consuming 25% of the chart.
If someone can explain or give code (Java/JRXML) snippets for how to set this kind of chart up, I think it will help connect all the dots and help me understand how components get filled with data. Thanks in advance for any and all help!
Think of parameters as things that the end user supplies to the report at runtime. For example, you supply a StartDate and an EndDate that will get used in a query. The start date that you are interested in is something you know, it's not provided by the data source. (There are variations on this idea: maybe your application knows things about you based on your login, and it supplies these as parameters. But again, these are things known before the report is executed.)
Think of the fields as the data that comes back from your data source. This is the stuff that you want to learn. For example, you run a query like this:
select political_group, gullibility from mytable where the_date > $P{StartDate}
Presumably you would input a value of '802701' for the StartDate and then get results like this:
$F{political_group} $F{gullibility}
Eloi 75
Morlock 25
Think of variables as a way to manipulate this raw data. They can calculate totals and subtotals as well as line-by-line calculations like string manipulation or more complex things like running totals.
Take a look at this pie chart report I posted a couple of years ago: http://mdahlman.wordpress.com/2009/05/02/limiting-pie-pieces/
It has the main ideas you want. I put the title directly into the chart rather than as a separate field. That would be a very simple change. Likewise, you could change the title to "The author of this report is: $P{TheAuthor}" and then pass that param to the report at runtime.
Using a field in the report title rather than a parameter is possible also. But typically it doesn't make sense. The fields will have many values in the data set. Which one belongs in the title? In the case above "Eloi" and "Morlock" are fields, and they really don't make sense in the report title. (You can imagine special cases, of course. You could concatenate all of the political_group values into a single string and put that in the report title. But in an overwhelming majority of cases this won't be reasonable.)
Good luck.
Hi I am very new to Android Development. I want to pick the country name based on the current time of the particular mobile, while clicking the button. How can i do it? Any body tell me? Thanks in advance.
It seems difficult considering most timezones contain multiple countries (and countries multiple timezones as well).
See: Android: Is there a way to get timezone for Country name?
Per above, the closest you'll get comes from here:
For getting the time zone, check out the "O" and "T" format specifiers
of the date() function. "O" will give you the Difference to Greenwich
time (GMT) in hours (your time zone offset) and "T" will give you the
time zone abbreviation like "EST" for Eastern Standard Time.
e.g. <?php echo date("T"); ?> will give you the executing PHP script timezone, for the user timezome you can pass their date/time as the second argument.
I don't think thats possible because you can have MANY MANY countries on the same time. For example, just take the GMT+/-0 time zone, you'll have England, France, Spain, Portugal, and a few others you can get from the african countries. You can't do it like that.
What i'd suggest is to implement a GEOIP location using for example: MaxMind GEOIP. You have some very powerful tools available in PEAR for that and it took me about 4 hours to setup the library, understand the code and do the code to query. I was querying for IPs and countries and even states/provinces in less than 4 hours. You can't get faster than that unless your a genious :)
I am building a set of chart displays, one of which is for a month display of daily trading - that is, one point of data per day (closing).
Since there is no trade during weekends and holidays, I need to discard these data points. Not only that, but data points should still appear adjacent to each other, regardless of any gaps in time. This can be seen in any such chart e.g. in the 3 month graph for Nasdaq on Yahoo Finance - see how weekends are skipped.
My question is: how should one correctly implement this in JFreeChart?
Thanks in advance!
In addition to omitting the excluded data points, you can apply a SegmentedTimeline to the corresponding DateAxis. For example,
axis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
Although deprecated in the current version, as discussed here, the implementation may guide creation of a custom TimeLine, as noted in a comment here.