Does anybody know, if it is possible to hide the axis in a JavaFX ScatterChart object? Or can anybody think of a simple workaround? I didn't find anything related to this issue in the documentation of the ScatterChart object.
Unfortunately, they are kind of irritating in all kinds of graphs where the axis's values are not, per se, informative (e.g. distance configurations).
Note: the most simple solution to set the visibility attribute of the scales to false unfortunately did not yield the result I was longing for (actually it showed no effect at all).
When you say "Hide the Axis", I'm assuming you mean hide all the tick marks and tick labels. Please let me know if you mean different.
The first step would be to hide the tick labels - this is pretty straight forward:
xAxis.setTickLabelsVisible(false);
yAxis.setTickLabelsVisible(false);
The second step is hiding the tick marks and all the neat graphics stuff that goes along with the tick marks (like the background colors). The best way I found for doing this is through the CSS. So you'll need to create a CSS file (I created one called test.css and placed it in my project's base folder) and load it up. Loading it can be done like this:
sc.getStylesheets().add("test.css");
(where sc is the ScatterChart object)
This is the CSS code I used to remove all the visuals associated with tick marks:
.axis-tick-mark,
.axis-minor-tick-mark,
.chart-vertical-grid-lines,
.chart-horizontal-grid-lines,
.chart-vertical-zero-line,
.chart-horizontal-zero-line {
-fx-stroke: transparent;
}
.chart-alternative-row-fill, .chart-alternative-column-fill{
-fx-fill: #f5f5f5;
}
Oracle puts out a great CSS reference for JavaFX - but in addition to that, I would recommend downloading the default CSS JavaFX uses. Looking at the default helps tons. You'll find instructions in that link under the "Default Style Sheet" section and also on the web with caspian.css for JavaFX 2.2 and modena.css for Java 8.
Related
Is there a way to get the default Pie Chart color in JavaFX? I've been looking for solutions but I couldn't get any. I have seen a way to set the color of the Pie Chart, and then work my way to get the Color value. However, I want to just use the default color of the PieChart provided by JavaFX, and just return it so I could use it for something else. Is there a way to do it?
With JavaFX 8+ the default CSS theme called Modena and you can find a lot of information in this Github gist. All the charts are using the same color palette which is :
CHART_COLOR_1: #f3622d;
CHART_COLOR_2: #fba71b;
CHART_COLOR_3: #57b757;
CHART_COLOR_4: #41a9c9;
CHART_COLOR_5: #4258c9;
CHART_COLOR_6: #9a42c8;
CHART_COLOR_7: #c84164;
CHART_COLOR_8: #888888;
keep in mind that although the link above is a good way to find some properties is always recommended to read the JavaFX CSS Reference Guide
I am designing my app UI with the GUI Builder. I created a new Form and defined a style as follow :
FinishFlagIcon {
background-image: url(pics/FinishFlag.png);
cn1-background-type: cn1-image-scaled-fit;
cn1-source-dpi: 320;
font-size: 11.9mm;
}
I set this style on a label and it appears on the GUI Builder.
However when I launch the project in the simulator it does not appear anymore.
I also tried to use a Scaled Label and defined the icon as FinishFlag (which was present in the res file), and again it appeared in the GUI Builder but not in the simulator. Of course there is no error printed in the console telling me the file could not be found.
Please note: the res/myCustomTheme.css folder holds all the subfolders related to the png (and those subfolders are populated with low to hd pngs) and the src/theme.res has the pictures (folowing Shai's advice) :
So what should I do to make the picture appear in the simulator ?
Edit : I tried to hand code the UI and added a Label (with the UIID defined above) to the the central area of a BorderLayout. I does not appear either until I add 3 spaces or more to the Label. I did not try again with the GUI Builder. It looks odd to me, is it done on purpose ?
Edit September 13th 2017 : If I build the app and open it on a real Android device then the labels appear.
Edit September 15th 2017 : For people having the issue of component not showing, as advised in the accepted answer the solution consists in removing top or bottom constraint of the component not showing and setting it to auto (click on the lock) so that there is enough space for the components. So eventually after setting to "auto" the bottom constraint of the progress bar an labels the expected result appear on the simulator :
Any help appreciated,
The images in your issue are a red herring. It looks like the problem is with your layout insets. Notice that none of your lower components are showing up in the simulator. The "progression" label, the three zeroes, etc...
I can't see the constraints you are using for the flags or the zeroes labels, but I can see that the "progression" label has fixed insets on both top and bottom. This may result in a zero height if there isn't enough space for it. Try changing either the top or bottom insets to "auto" so that they are flexible.
Try changing the simulator to use the desktop theme so that you can resize the window and see how the form looks at different sizes.
You can also easily verify this by overriding the layoutContainer() method of the form, and check the height that your flag label is getting:
public void layoutContainer() {
super.layoutContainer();
System.out.println("finishflag height: "+gui_FinishFlag.getHeight());
}
I'm not sure what's the "right" solution for this so maybe Steve can interject but this is what's happening.
You have two resource files: theme & theme.css.
The images in theme.css work great for your styles. However, since the loading process loads theme and not theme.css the simulator is unaware of these images as the theme res file doesn't know of them.
The GUI builder is probably scanning all the res files here so it lets you do that which might be a mistake... You have the following options to workaround this:
Load theme.css and discard theme - you will need to define the inheritNativeThemeBool flag and should no longer use the designer tool if you take that approach
Use the designer tool to load the images rather than CSS
Explicitly load the css res file using Resources.open and explicitly pass it to the Form
Explicitly load the css res file using Resources.open and set it as the global resource file
I am working in a style sheet, I had no major problems with styling until now. I need to remove the three little dots in the middle of the split-pane-divider.
I found no information about those three dots in the JavaFX Reference Guide.
I cant upload a picture to make it clearer, with the resources found on the reference guide I managed to change the background color, borders, and orientation, but the small dots in the enter remain there.
Have a look at the caspian.css file in the jfxrt.jar
Maybe you see there how they styled the split-pane-divider and then you could override it.
Edit:
The OP suggests now the following solution:
.split-pane *.horizontal-grabber {-fx-background-color: transparent, transparent;}
https://stackoverflow.com/review/suggested-edits/2290698
For some reason, the arrow on the tooltip for each graph point appears below the actual label(see image). I have tried doing everything to move it and can not figure out why this is happening. The tooltip is generated automatically by dojo's chart library. It appears fine in the demos.
Does anybody have an idea why?
EDIT:
I am using Dojo 1.7.2.
The code is question is
this.linePlotName is part of the object that the method below resides in.
var anim = new dojox.charting.action2d.Tooltip(newLineChart, this.linePlotName);
I had the same issue after I upgraded my Dojo from 1.6 to 1.7.2, but this issue was actually a bug and it is fixed now in 1.7.3: http://bugs.dojotoolkit.org/ticket/15016
Upgrade and it should be fine.
It's hard to say, without seeing what else is going on in your code. However, it's important to keep in mind that the tooltip's behavior is influenced by the widget/div/frame it's contained in. If there's not enough room to render the tooltip graphic on top of the plot line, it will be drawn under it. Try increasing the size of the container the chart is contained in, and try increasing the size of the chart itself, so there's plenty of room above the plot line for the tooltip to appear, or even try just scrolling up/down. It's best to rule out the easy fixes first. :) If that doesn't work, please comment, and we can go from there...
I'm quite new to Qt and I'd appreciate the ability to customize a QTableWidget. I found a nice CSS-like interface using the stylesheets as shown here
http://doc.trolltech.com/4.3/stylesheet-examples.html#customizing-qtablewidget
However, I need to change some more specific styles (like grid color, items background color and so on).
I couldn't find any documentation describing the properties that might be changed via stylesheets.
Thanks for any help.
EDIT
Thanks, it helped a bit...however i still missed some other properties as grid thickness, but i "solved" it by inserting a row/column with 1px height/width to double the gridline :) And the QTableWidgetItem::setBackgroundColor() was also helpful.
However, I'm still facing some issues with QTableWidgetItem, the text keeps hiding if the column is too slim...only 3 dots appear. Dont you have an idea? I need the text to be visible, even if a bit clipped, but from the problem definition I cannot resize the column.
Isn't
http://doc.trolltech.com/4.3/stylesheet-reference.html#list-of-properties
the list you are looking for?