I have made the plot to repaint the graph from the first once it reaches end. Now my problem is the graph gets overwritten. The previous plot remains as such. So, how should i repaint after clearing the previous plot? And by clearing i should not loose the previous data. It should remain as such when i scroll.Can someone help me with this pls?
I will try to answer the questions I understood:
You can clear data from the previous series, by removing it
You can control the visible area by using renderer.setXAxisMin() and renderer.setXAxisMax()
When you want the cursor sent back to the beginning, you can create a new series and start adding data to this series
You can hide the legend, if you don't need it by calling renderer.setShowLegend(false)
The changes will be visible on the screen after calling chartView.repaint().
Related
I've a graph in Jung shown using a JFrame.
After I remove a vertex from the graph,
the shown graph automatically redrawn and presented without the removed vertex.
How can I disable it, so that only when I call the repaint method
the graph would be redrawn ?
Thank you
The simple way to do this is extend your graph by some class and add toRemove() method, where you can signify your vertex to delete in boolean array. And the second method deleteNow() which will use your boolean array and delete your vertexes - it will be alike repaint() now. The second way is add boolean value to your vertex instead of array in your extended class. I can't find any other way. Sorry if it's not helpful.
You haven't really given enough information to be able to advise you precisely, but here are some general observations.
The answer to your question is going to depend in part on how you're removing the vertex: interactively or programmatically.
If it's programmatically, then you'll need to look at the code that calls VisualizationViewer.repaint(). It's been a while since I've looked at that part of the code, but the gist is that something is listening to changes to the graph model and triggering repaints (because this is what users generally want).
If it's interactively, then it's probably on the same thread as your visualization, and you should have a fair amount of control over when repaint() gets called (see the calls in the sample code to VV.repaint()).
I have a mock up that I want to create for when I'm switching between views in a viewpager.
The filled in circle would be indicative of a previous page, the semi-filled in circle would indicate current page and the last couple of empty circles would be the upcoming pages not currently viewing.
I was wondering where can I get started on how to create something like this?
I was also wondering how would I know how many pages are left to be viewed set that equal to the number of empty circles to show.
How would I be able to move along the circle images when swiping between views?
Thanks.
You dont need to reinvent the wheel for it so you can use library with little modificaiton in its source code.
use the library
https://github.com/JakeWharton/Android-ViewPagerIndicator
library have CirclePageIndicator which is performing the thing you need setting current circle as you scroll pages in ViewPager.you will need to add code to below class to drawPrevious circle in onDraw method.you can do that by storing previously selected page in variable and draw the previous page indicator as per your need.
https://github.com/JakeWharton/Android-ViewPagerIndicator/blob/master/library/src/com/viewpagerindicator/CirclePageIndicator.java
i create a Object of a extended Area Chart. In this Area Chart is a dataSerie if the object is created. Later i will add 3 New Data Series to the Area Chart and the first dataSerie musst be deleted.
How can i delete the first dataSerie?
areachart.getData().addAll(s1, s2, s3);
Here you can see how i add the new Series into the areachart, but first i want to delete the old ones...
Thanks for your help
So now I know it! I can use the following Statement:
areachart.getData.remove(....)
But this makes another Question open! How can i get the total added Series of the Area Chart.
How can I get the information of how many series in the Area Chart are?
I fixed the problem by myself.
You can do something like this:
areachart.getData().removeAll(m_histogram.getData());
It will remove all kind of data inside the area chart!!
I am writing a browser based application using GWT and making use of websql (yes, I know it is deprecated). I have created a custom table widget (based on FlexTable) and enabled it to scroll with the help of some CSS trickery. What I am striving to achieve (without much success) is that when the user scrolls to the start/end of the current data in the table, an event is fired and the next subset of X rows is returned from the websql DB and replaces the data currently in the table. In order for this to work, I need to keep track of the data offset in the table widget so that I can pass this to the query and use the limit and offset functions of SQL to return the required data. However, I just cannot seem to get the logic right to implement the data offset tracker within the widget. Another complication is that I need the table to be able to scroll 'into the past' (so to speak), so that it can retrieve data from before the initial start point when the table loads.
I have been at this for a number of days now and just cannot seem to get it right. So I was wondering/hoping that someone might be able to point me in the right direction (PLEASE!).
Thanks in advance
Tim
I am not sure why this is causing a problem.
int page = 0;
// when you hit the bottom
page++;
loadData(page);
// when you hit the top
if (page > 0) {
page--;
loadData(page);
}
Tim I think it is not a good idea controlling the scroll with CSS trickery.
I have done something similar soon and controlling all the logic (pagination, scroll positions,...).
What I suggest to use is a gwt's scrollPanel, a HasData widget (like a cellList) your custom AbstractCell (class which is rendered for each row of your list) and asyncDataProvider ( which gives you the onRangeChange handler for asking to your server when the range data display has changed).
You can force/fire that event when in scrollPanel.addScrollHandler detects you are arriving to the end.
If you want to see all of this in action have a look into (click on source code): http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCellList
EDIT [according comment below]:
A. If you want to override the data (in the example is X+X+X...) with the new retrieved just maintain always the same range of data displayed [display.setVisibleRange(0, newPageSize);], and start from 0 when you render the new data (on your RangeChange listener).
B. If you need to have control over up and down scrolls instead of taking advantage of the used events internally on the cellList (basically onRangeChange), you can create your custom events and fire them (this option could be easier for your colleagues for understanding everything). And do not worry about controlling up and down scrolls, inside the ShowMorePagerPanel.java you can see a simple example of knowing up and down controls.
Anyway, I did not explain more detailed because I did not see you very convinced to use CellList approach (and I was using my tablet :D ).
If you change your mind, just let me know and I write for you a proper example step by step (this part could be tricky, so if you are lost it is normal ;) ).
My app needs to display information (lines and rectangles). I was thinking of using JPanel, but I am not sure.
The problem is that the information is stored in a DB, but when the app is launched, eventually new information will get into the DB, and should be displayed as well. Also, the existing displayed information must remain.
Also, it would need at leats two zones for displaying info. One for lines and another for rectangles. Both with the problem of incoming information.
What is the (best) way to add new elements to a graphic without loosing what has been displayed before?
Have a look at Canvas and Graphics (Tutorial). You need to add the Canvas to a JContainer for example JPanel. With JDBC you can connect to a Database and execute SQL Statement.