I'm trying to build a line graph that only shows the vertical highlight when you touch or drag on the graph. I'm able to remove the highlight completely and even have an image show up on where I touch or drag it. But so far, I haven't been able to remove the horizontal line. I used these other resources to try and get it to work, but they haven't really done much for me yet.
MPAndroidChart LineChart custom highlight drawable
https://www.programmersought.com/article/1729477382/
https://weeklycoding.com/mpandroidchart-documentation/highlighting/
I'm using the latest version, 3.1. I read here on one of the issues that you couldn't remove the horizontal line in older versions of the library. https://github.com/PhilJay/MPAndroidChart/issues/814 But I assume that maybe they did something to change that.
LineChart line_data_chart = v.findViewById(R.id.line_data_chart);
line_data_chart.getAxisLeft().setEnabled( false );
line_data_chart.getAxisRight().setEnabled( false );
line_data_chart.getLegend().setEnabled( false );
line_data_chart.getXAxis().setEnabled( false );
line_data_chart.getDescription().setEnabled( false );
line_data_chart.setScaleEnabled( false );
line_data_chart.setOnChartValueSelectedListener( new CustomChartGestures() );
line_data_chart.setMarker( new MarkerImage(getContext(), R.drawable.home_icon));
//line_data_chart.setHighlightPerTapEnabled( false );
This is my code so far. I was thinking of making an image of a vertical line and using that instead of the home icon. But I feel like there is an easier way. I also thought of implementing the Highlight class but it still seems like overkill. I've been searching for a couple of hours at this point. Any kind of suggestion is very much appreciated.
If I understand correctly you are trying to remove the horizontal highlight line
Maybe this question will help - How to disable highlight line in MPAndroidChart?
dataSet.setDrawHorizontalHighlightIndicator(false)
So I ended up just using an image that would change size with different size screens but this doesn't seem like the most optimal solution.
If anyone has any better answer to this problem please share it. I would greatly appreciate it.
Related
I wanted to print a few programs for a school project on bluej. When I click the print button and set the paper size to A4 and give 'OK' the print comes in a weird small box. I tried increasing the font size. No changes happened. I also changed the page type to the different ones available, but no luck. Please tell me how to solve this problem.
There are two possible ways to solve your problem. The first is to copy-paste your code into another program, for example Word. The second way is to printscreen the code you want to print and then spread this picture across the A4. Maybe you should cut the edges off first.
I would like to see visually how much space each box takes with as little effort/changes to the code as possible.
I would like to know if it's possible to just put a line around the outer margins of the View or ViewGroup object.
Since it's just for debugging and styling I would like to also quickly turn it off, so I do rather make the changes to my code in one place so it's easy and quick to undo. Is this a default option I am missing? Somehow I expect this feature to exist already.
Here someone asks a different but slightly related question with not a nice answer for my case.
Here someone gives an answer on how to outline one View.
Border for an Image view in Android?
Code-wise you could follow the answer to the first link you posted and create a drawable with the name "developer_borders" or something similar and apply it to every view you wish to have its borders visible.
To easily remove it afterwards, you can right-click the directory of your project and click Replace in Path.... For Text to find you want to search for android:background="#drawable/developer_borders and for Replace with don't use anything. This will find every occurrence of what you are searching and replace it with an empty string.
There might be an easier option. Some devices have quite powerful Developer Options. "Show layout bounds" is what you want but take a look at the rest while you are at it, some are pretty awesome.
I have a problem with the text not displaying properly on my screen, It appears as a blank rectangle with the same text color, Just no text...
Everything else works fine though, Menus and crosshair and other 2D stuff renders fine. I'm using this tutorial: http://www.lwjgl.org/wiki/index.php?title=Slick-Util_Library_-_Part_3_-_TrueType_Fonts_for_LWJGL
getting this result:
EDIT: I managed to fix that issue, But now I have another problem, Text is displaying with a black background, Like this guys issue: http://www.java-gaming.org/index.php?topic=26944.0
but his fix which is disabling depth test does not work for me...
You might need to change the order in which your objects are rendered.To make sure it works correctly they should be rendered in back to front order. See here
Are you enabling GL_BLEND? If so, try setting glDepthMask(false); after the glDisable(GL_DEPTH_TEST).
I've been bashing my brain against this one for a few days but I can't find a straight forward answer to the question on google. There's plenty of CSS stuff but I don't really know what crosses over from general CSS domain into JavaFX CSS domain (if any of it does, and really I'm nto sure that anything does).
I have a label that is functionally a button. It has 3 states reflected by CSS:
1: Idle, nothing special.
2: Hovered This is where I want the text to appear "raised"
3: Pressed: I was able to figure this out.
For hovered I have the following CSS:
.label:hovered{
//What goes in here to make the text appear embossed (raised) when the cursor
//is hovering over it?
}
I've tried the -fx-effect : innershadow(...) but it isn't really providing the ideal desired effect.
EDIT:: For a bit of clarity this is for what I am going (See #3). I tried the CSS but it did not work.
The appearance of the control is thus right now:
You can use a Lighting effect, here is a link to the Oracle tutorial on lighting.
The effect cannot be applied via CSS in Java 8. You could apply it in code or via xml.
You can add a listener on the hover property of a node to switch lighting off by setting the node effect to null and to switch it on by setting the node effect to you lighting.
There is example code in the JavaFX javadoc on Lighting, which I've just reproduced here:
Light.Distant light = new Light.Distant();
light.setAzimuth(-135.0);
Lighting lighting = new Lighting();
lighting.setLight(light);
lighting.setSurfaceScale(5.0);
Text text = new Text();
text.setText("JavaFX!");
text.setFill(Color.STEELBLUE);
text.setFont(Font.font(null, FontWeight.BOLD, 60));
text.setX(10.0);
text.setY(10.0);
text.setTextOrigin(VPos.TOP);
text.setEffect(lighting);
A drop shadow would also work and there are likely other ways to achieve what you want, all with slightly varying results.
I am using Vaadin 7 rc1.
I would like to create a HorizontalSplitPanel that adjusts its width if the left side is wider then the given width.
The default behaviour is that a scrollbar appears on at the bottom of the screen if the content is wider then the given size. However I would like to have the left side widened.
I am new to Vaadin and the book does not go into details like this.
How is this possible in Vaadin 7?
Any help is appreciated!
Thanks!
Try to call method setSizeFull() on the HorizontalSplitPanel.
Then open the application in e.g. Chrome and Inspect the split panel element. See what has been changed and try to play with width/height values in the inspector. That might give you a clue what is wrong. Maybe you need to call setSizeFull() also on components that are contained in split panel?
The is a function in HorizontalSplitPanel that do exactly what you looking for :
panel.setSplitPosition(float f, Unit unit);
You can use either
Unit.PERCENTAGE
or
Unit.PX
... there is a lot of possibilities.
I have managed to solve the situation with other layout structure.