Initialise Google Motion chart with log axis - java

I am not sure if this is the place to ask, but I saw another question about google motion charts here, so here I go...
I have javascript that creates a chart, I don't initialise a state, but I read here how to do that.
My question is, how do I start the chart with logaritmic axis? I haven't found any documentation about this. Perhaps I have overlooked something. Thanks for any ideas!

Got it. Follow these steps:
Open a working chart and set the settings that you'd like to capture. Settings you can specify include opacity levels, zooming, and log vs linear scaling.
Open the Settings panel by clicking the wrench symbol in the lower right corner of the chart.
Click the Advanced link in the lower left corner to add the Advanced panel to the set.
Expand the Advanced panel and copy the contents of the State text box to your clipboard. (Note: instead of using the menu, described in steps 2—4, you could insert a button on your page that calls getState() and displays the current state in a message box.)
Assign the state string that you copied in the previous step to the "state" options parameter in your code, as shown here. When passed into the draw() method, the chart will be initialized to the state specified on startup.
I think the log/lin refers to the parameter xAxisOption: 2.
Somewhere in the beginning of the code, paste this (and replace the state with your clipboard content):
var options = {};
options['state'] ='{"duration":{"multiplier":1,"timeUnit":"D"},"yLambda":0,"yZoomedIn":false,"showTrails":true,"dimensions":{"iconDimensions":["dim0"]},"uniColorForNonSelected":false,"nonSelectedAlpha":0.4,"xAxisOption":"2","iconKeySettings":[],"xZoomedDataMin":18.75546,"time":"1985-02-12","colorOption":"4","xZoomedDataMax":1133.55129,"orderedByX":false,"orderedByY":false,"xLambda":0,"playDuration":15000,"iconType":"BUBBLE","yAxisOption":"3","yZoomedDataMin":-32.736,"xZoomedIn":false,"yZoomedDataMax":-1.166,"sizeOption":"5"};';
Then comes the chart data and in the end:
options['width'] = 760;
options['height'] = 480;
chart.draw(data, options);

Related

Website Button does not work in mobile Layout

I have a really weird error that I'm trying to resolve. On a website I built with the visual composer, one of the buttons that leads to an internal anchor (#whatwedosmall) on the same site just wont work on the mobile layout.
This is the site: https://b8j3ssh.myraidbox.de/
I created 3 layouts (large, medium, small) and each section has a certain ID (for example the What we do section in large is named: #whatwedolarge and so on. Within the site there are buttons that lead to these sections and it works great!
However, the very first button on mobile (breakpoint smaller than 600px) just wont work at all. I tried everything but I cannot get it to work...
Can you help me?
When you inspect the page at a breakpoint < 600px you can see that your button (actually an ) is being covered by the rev_slider_1_1 so the actual can never be hovered or clicked.
If you delete that slider from the DOM in DevTools or set the height manually, then the hovering and click work. As you can see in the screenshot below, manually setting the Slider height to 850px allows me to hover and click
You need to determine how the height of that slider is being determined and fix that in your code.

Get and set focus position in SWT browser

I want to get and set the position within a SWT browser but I don't know how.
First, I created a browser control:
Browser browser = new Browser(shell, SWT.NONE);
Then I launched a HTML document:
File file = new File("C:\\test\\index.html");
browser.setUrl(file.toURI().toString());
That works perfect so far.
Now I scroll down the page to find an interesting text passage and click a menu item to create a kind of bookmark.
My question is: How can I get the current focus position (x,y) to remember the point in the text and how can I reset the position later to "apply" a specific bookmark?
You can interact with the browser content through Browser#evaluate() and Browser#execute().
Both methods allow to execute Javascript in the context of the browsers document.
To send Javascript code that queries the current position, use something like:
Object position = browser.evaluate( "window.getCurrentPosition();" );
The type of the return value depends on the code that is evaluated. Debug through the code to see what the actual return type is.
If you aren't interested in the return value, use execute. For example to set the current position you would use:
browser.evaluate( "window.setCurrentPosition( x, y );" );
Please note that the Javascript is pseudo-code and doesn't actually return the current position.
If you run into SWTExceptions, it is likely that the document isn't fully loaded yet and you need to delay the execution of the Javascript code until it is fully loaded as explained here:
https://stackoverflow.com/a/7802717/2986905

How can I get an Embossed (raised letter) effect on text through CSS in JavaFX?

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.

Best way to implement refusing a value change by the user in Swing?

I have a JCheckBox that should not be checked by the user when a certain other field is empty.
So now I want to have an error popup and then reset the checkbox (I've considered disabling the checkbox, but the connection to the other field is non-obvious, and a tooltip text IMO not visible enough).
What's the correct way to do that in Swing? Through a PropertyVetoException? Where do I throw it and where do I catch it? My first (probably ugly) idea would be to add a ChangeListener that itself shows the popup and resets the value.
Edit: The question is about Nikki (screenshot below), an app I am developing which geotags images and exports them to Google Earth's KMZ format. The checkbox is used to select the images to include in the export. But this requires the images to be gotagged first (which in turn requires either a timestamp, or manual assignment). I don't think this requirement can be made obvious through the UI layout.
(source: brazzy.de)
I would simply disable the check box and add a message explaining why the option is not available. A nice way to show the message is to display a mini exclamation mark next to the check box and put the message in a tooltip.
Poping up an exception often feels wrong because users don't read error messages. For most users an error message popup means that the application did something wrong, in your case it's the normal behavior.
Edit if you insist on letting the check box enabled, another way to show the user that some info is missing would be to flash the missing data. Eg. if latitude and longitude are missing and the user clicks on export, set a red background onto these fields for a just a second. This will clearly show the user what's missing.
In this screen, don't you want to put the mouse over the red circle to understand what's going on?
validation http://www.vogella.de/articles/EclipseDataBinding/images/validation10.gif
I don't think the Export JCheckBox should be disabled at all. Instead, the Export JButton itself should examine the current export list and display any anomalous entries in a way that allows navigation to a chosen photograph. If all entries are correct, Export would proceed as usual.
Addendum: It think you are right to keep the interface as non-modal as possible. My model for this would be unsaved files when exiting an editor or uncommitted changes when closing a project in an IDE.
If that's a status line at the bottom of the window, you might indicate the number of photographs currently selected for export, adding a count if any still need geocoding.
The field should simply be allowed to disable the checkbox. If the coupling is unintuitive then the GUI layout may have to be reconsidered.
EDIT: I ran it from your page, and I believe the issue here is that you actually have a third and fourth step in addition to select folder, select images. The third step is validate image, and fourth is select images for export. I think your problem is that this is not clearly conveyed in the current layout, and that reflects in your question.
I would suggest that you create a separate column containing the checkbox for each image, and that THAT checkbox is disabled until the image passes validation (step 3). Perhaps with an explanatory text in the column about why the image hasn't passed yet.

How do I make a RichTextArea in Google Web Toolkit(GWT) Selectable/Highlight-able by a mouse but not Editable/Modifiable?

I'm currently making a GWT project where I display some HTML in a RichTextArea, and I want the RichTextArea to be selectable/highlight-able by a mouse but NOT be editable/modifiable by the user. In addition to this question, could you also tell me how to retrieve some highlighted text in string from without me having to add a text-background toolbar, which, after highlighting a text from the RichTextArea, you change the color of the text-background, upon which, you add a separate periodically looping thread which checks to see when the text-background changes substantially from white (or a native color of the webpage) and finally extracting the string whose text-background color differs as the selected text.
I really hate to give any pointers without explanation but i think your requirements are bigger ::: so --->
http://examples.roughian.com/index.htm#Widgets~RichTextArea
http://www.java2s.com/Code/Java/GWT/RichTextArea.htm

Categories