I have a vaadin project where I use visualizations-for-vaadin addon, which is a wrapper for gwt-visualizations. What I need is an AreaChart with stacked areas and one reference line on it. So kind of combination of an AreaChart and a LineChart. I understood, that if I want to achieve this, I have to write/extend my own AreaLineChart. Can somebody point me into the right solution how to do it? I am browsing through the visualizations code, but still cannot find out how to do it.
The specs for the chart would be something like this:
class AreaLineChart {
public void addArea(...);
public void add(....);
// this is the new method I need in the area chart
public void addLine(....);
}
Thank you,
Filip
If you would consider switching charting packages, the Invient charts addon is a wrapper for the High Charts package, which is very pretty looking. Conveniently, it already wraps the combo chart for you. See the demo here and click on the combination charts at the bottom.
Use an AreaChart where you can define areaOpacity to 0 for drawing a line.
But for this you need to use the "series" option.
Related
I would like to present some Values inside a Radar Chart.
Long-time I was working with AndroidPlot which works great but it doesn't support Radar charts.
So I swapped to MPAndroidCharts.
But MPCharts only supports angular RadarCharts by default.
I found the following Link in the Issues, but there is no Code given
https://github.com/PhilJay/MPAndroidChart/issues/1446
Another Stack Overflow Entry I found is this, but I can't combine it with MPAndroid Charts
Radar Chart for Android
At the Android Charts Library:
https://github.com/limccn/Android-Charts
rounded Charts are mentioned, but I can't find the according Class in Code
Is there already a solution to make MPAndroidCharts RadarCharts round,
or any other Library that supports rounded RadarCharts.
Thanks for Help
go to RadarChartRenderer class.
and edit the method inside class like below:
protected void drawDataSet(Canvas c, IRadarDataSet dataSet, int mostEntries) {
..........................
..........................
mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
mRenderPaint.setStyle(Paint.Style.STROKE);
mRenderPaint.setDither(true);
mRenderPaint.setStrokeJoin(Paint.Join.ROUND);
mRenderPaint.setStrokeCap(Paint.Cap.ROUND);
mRenderPaint.setPathEffect(new CornerPathEffect(30) );
mRenderPaint.setAntiAlias(true);
............................
............................
}
my results like:
As mention in the issue link, you can implement it by yourself, just see https://github.com/PhilJay/MPAndroidChart/blob/c1f6fcebf0c3516e067b34312b283189f909bde5/MPChartLib/src/main/java/com/github/mikephil/charting/charts/RadarChart.java as a reference,
write your RoundRadarChart class to extend the RadarChart
write your RoundRadarChartRenderer, YAxisRendererRoundRadarChart and XAxisRendererRoundRadarChart to extend the RadarChart ones, mainly you should to override the drawXXX functions
use your new renderer classes in your chart class to replace the RadarChart renderers
You need to re-caculate the factory of drawing lines, points and labels
And about the Android-Charts project, you may have a look at https://github.com/limccn/Android-Charts/tree/master/src/src/cn/limc/androidcharts/view. Not sure if the RoundChart is what you want.
There exists an NVD3 chart for combining a line and bar chart, linePlusBarChart. This would suit my data very well. However, it does not seem to be supported natively with rCharts. As far as I can see, the NVD3 charts which are implemented in rCharts are (from examples):
scatterChart
multiBarChart
multiBarHorizontalChart
pieChart
lineChart
lineWithFocusChart
stackedAreaChart
Is it possible to get other ones to work? It may be that I have misunderstood the structure of rCharts+NVD3! I'm quite new to Java, so I would be very grateful for good references, documentation, and general help!
But my basic and immediate question is: How to get a linePlusBarChart from rCharts? Or a way to layer a lineChart onto a bar chart?
Thanks!
I have a JTable in a JScrollPane but I'd like to change the look of the ScrollBar to something a bit better looking; a 'custom design'. Maybe put an image that a user can drag instead of the default thick blue bar. Is this even possible?
The main thing I'd like to do is change the thickness of the bar. My application uses a small window and the ScrollBar looks too thick.
Any help will be much appreciated.
Edit:
Thanks for the responses so far. I just found this; answers my answer, in part: java scrollbar thickness
Unfortunately I cannot provide a sample at the current moment, but you should definitely look into this
The BasicScrollBarUI class allows you to modify different features of a typical JScrollBar, such as various different colors, sizes, and shadow effects. This should be what you are looking for. Basically the idea is that you are supposed to override the installDefaults method and just modify the protected fields to your liking.
But, if you want to get fancy, I would highly suggest looking into JavaFX due to the amount of customizability it supports, one being CSS styling (which should be very helpful to you).
I'm trying to do something quite simple, but I'm having a hard time finding good examples on the net to what I want specifically.
I'd like to somehing very similer to what it's here:
Dao
It's a simple game called DAO and I just need to have a background image with 16 squares (4x4) and drag and drop the images (pieces) on each square to the others. I'm developing the interface using swing and I simply want to know a good place to find tutorials for such implementations or a simple suggestion on how to do it.
Thanks in advance
Shameless plug:
have a look at my simple example via my google project
http://code.google.com/p/jchronos/
There is code to drag list item across list boxes. Same should be applicable to JLabel
Look at sources
http://code.google.com/p/jchronos/source/browse/trunk/src/org/jchronos/ui/QuadrantPanel.java
http://code.google.com/p/jchronos/source/browse/trunk/src/org/jchronos/ui/ArrayListTransferHandler.java
I'm trying to implement a small-scale strategy, taking turns game
implemented in Java, GUI is made with JFace and SWT.
My challenge is to write a GUI implementation of the world map,
where countries will act as clickable buttons. However, countries
have no fixed boundaries, no rectangular shape, and simply no way
I can think of to be described in a grid layout.
This is my first time trying to implement a project of this type,
please advise
If it's a tile based map (like at Civilization) or it's displayed as pixmap, you could save the ownership of each tile/pixel in a two-dimensional array. Just display the map a a simple, clickable pixmap in a canvas an add a MouseListener. If you get a click event at the coordinates (X,Y), you can just get your country like:
Country clickedCountry = myCountriesOnMap[X][Y];
... in your Listener implementing the MouseListener interface. myCountriesOnMap would be of type Country[][].
Of course, you will need an algorithm that will resolve the ownership for each tile/pixel at startup or if a territory gets conquered (I don't know, if this may happen). May be you will have to define your countries as polygons (like you would do it for a HTML map). I cannot help you on this, as I haven't done anything similar jet, but I'm sure you will find something on Google.
Greetings
Sacher
Try to use the OpenStreetMap data. It contains exact country borders and good image export possibilities.
The Key:border tag will show you all borders. You could extract it and calculate your clickable areas.