Tooltips sometimes appear empty under splite-plot-bands highcharts - highcharts

I'm testint information from a page with Selenium Webdriver. I have a graphic like this: https://www.highcharts.com/demo/spline-plot-bands
and I'm having a problem when I try to get the info inside of every dot.
You have to know that this type of highcharts, every dot has the same xpath so, it's impossible to reach to different dots. I can only get one info in one dot.
//Click on toolip
WebElement element = driver.findElement(By.xpath(dot));
// action class to click
Actions action = new Actions((WebDriver) driver); action.click(element).build().perform();
String toolTipText = driver.findElement(By.xpath(tooltip)).getText(); if(!toolTipText.contains(example))
sb.append("===> Content error");
The problem is that ramdomly, I get empty info from that tooltips. Sometimes I correctly get the info but sometimes it appears empty. Why? Will it be problem because json call? I don't know what could I do...do you have any ideas?
Thanks so much in advance guys!!

I think you are looking wrong way at highcharts, please refer this highchart docs. Highchart is chart plugin that auto render HTML SVG based on highchart options.
To understand problem with tooltip information, you need to look into highchart series data, point objects. point object is contains information related to each dot in chart.

Related

How to Add Extra Information in Hover/Tooltip

I want to add extra information in hover/tooltip in below shared highcharts links.
Please check and help.
https://www.highcharts.com/demo/line-basic
https://www.highcharts.com/demo/pie-drilldown
Did similar thing by using tooltip point formatter. Added the data as a different property "tooltipData" in series object, and later used it in the formatter and modified tooltip accordingly.
Link: https://api.highcharts.com/highcharts/tooltip.formatter

ToolTip Performance in XPages

I have a large XPage with about 170 fields on it. I have tooltips for a fair number of the fields. The tooltip does a lookup into a help DB and returns the related text. They work fine but they significantly slow down the load process because of the number of times the lookup is performed. I put a dBar.info statement in the JS that loads the text and in one load the document and put it into edit mode it would appear to have fired that one tooltip lookup 6 times. If it does that for every one of the tooltips then clearly that is the reason for the slow performance of the XPage. I did it both with the DynamicContent set to both true and false with similar results. I'm tempted to just remove the tool tips but that kind of defeats the purpose.
Is there a way to limit the tooltip to only fire the lookup when called? Like something linked to the MouseOver event. It seems to me the tooltip in the extension Library works OK if there are only a few fields requiring inline help but does not scale well.
Just as a test I removed all the tooltips from the XPage and while the loading is slow it is probably acceptable, but the tooltips slow it to the point of unacceptability.
Bill,
This is an excellent use case for an ApplicationScope bean. Create a bean that implements Map and uses an internal HashMap as cache. Let's call it tooltip. In your tooltip you define the label as EL e.g. tooltip['Manager']. XPages will call the get function. In it you check the internal HashMap if you have the value, otherwise you look it up. So lookup happens once only.
You could instead of looking up on demand opt for loading when initialized. Using a view navigator that should be very fast. Since it would be an Application scope only loaded once.
Makes sense?
You can use view.isRenderingPhase() to minimise the lookups during a partial refresh. With the tooltip you can also change the showDelay property so the tooltip has a delay before showing. This is a good thing to do for a view, so it doesn't try to load each tooltip as the mouse moves down the page. dynamicContent="true" may also mean it's not loaded with the page, but only when called - I haven't checked this so I'm not certain.

Dashboard using highcharts.js

I'm trying to build a dashboard using highcharts.js(multiple charts are displayed on a page), the data for these charts are fetched via ajax. Each of these charts can be refreshed independently. Initially when I was trying to get this working I was getting error #16 and I figured out that HighCharts.js was included and the ajax response was sending back HighCharts again and hence this error was being thrown by HighCharts.
To circumvent this I added js code to check if HighCharts was already defined and if it was I set it to null
if(window.Highcharts){
window.Highcharts = null;
}
This seemed to solve the problem, but however I now see that when I refresh one chart the other chart(s) on the dashboard seem to have some rendering issues - a part of the other chart(s) seems to have been stripped off.
Please let me know if what I'm doing is right, also please let me know a better way in which I can avoid loading HighCharts is its already loaded.
Assuming you have control over the HTML you're rendering, you need to do either;
Place highcharts (and other scripts) as a dependency in the page container so that you're sure it loads only once.
Conditionally load HighCharts dynamically rather than statically.
Eg something like this;
function buildChart(func) {
if (window.Highcharts === undefined) {
console.log("Highcharts is not loaded, fetching...");
$.getScript("http://code.highcharts.com/highcharts.js", function () {
alert("HighCharts was loaded");
func(); // build chart
});
}
else {
console.log("HighCharts was already loaded");
func(); // build chart
}
}
// test
buildChart(function () {
// build chart
console.log("Read to build chart with:", window.Highcharts);
})
However, this simple example doesn't cater for concurrent requests whilst highcharts is still being loaded. So for conditional loading like this, I would look into using a library like RequireJS, YepNope or HeadJS which can handle these dependencies for you. You are then able to include the HighCharts script in your components as often as you like and they'll only be loaded once.
Why are you loading highcharts with each span? You only need to load it once when the document loads.
Highcharts does not need to load each time a chart is refreshed...it's already there.
All you need to do to refresh individual charts via ajax is return a json object of the data for that chart, and re initialize the chart with the existing options that were set when the page loaded.

No geometry value provided at geodjango admin

I'm trying geodjango for my pet project and everything looks good with an exception...
In my model I have a field like this:
coordinates= models.PointField(srid=4326,default='POINT(0.0 0.0)')
and my admin extends from admin.OSMGeoAdmin but when I open a new model instance in the admin, I'm not seeing the '0.00,0.00' point selected in the map and if I try to save the document, I'll get 'No geometry value provided'. Like if the admin just Can't put the point in the map.
Also, if I try using the shell, I can save instances w/o problem and get the field with the default value POINT(0.0 0.0).
Am I missing something in the admin?
Thanks for any hint!
I have the same issue.
It's weird. What is getting POSTed makes no sense.
At the point of hitting submit the textarea has the correct geometry value (as I put an onsubmit on the form that outputs me this value).
But what gets submitted is not that value.
So I turned JS off... wow. The correct value is submitted and I am a little happier, but this is not a solution.
But what javascript is doing this I don't know.
I've tried this with Django 1.3 and 1.4.
Have you had any luck?
update. one more 'solution'... override openlayers.html and turn the textarea to a standard text input. wow. works again.
SOLVED!
So mine took some digging... but my admin uses tinymce... Tinymce works on textareas yeah.... well it screwed up the widgets textarea, but ever so silently.
editor_deselector : "vWKTField"
Well, after toying around with open layers.html (THANKS noisyboiler!) I found there is an attribute on the OSMGeoAdmin display_wkt, setting it to True will show the textArea without hacking the template.
For entries with existing points, it contains a value in this format:
SRID=3857;POINT(890338.8453418 -1109499.0330941)
So I just change my Point Field to:
coordinates= models.PointField(srid=4326,default='SRID=3857;POINT(0.0 0.0)')
What I understand from Spherical Mercator is that 4326 is for two-dimensional maps, but seems like google Maps uses 3857 which includes a spherical projection.
Now works!

Donut chart in highcharts appears messed up on export

We are using highcharts as our charting library. It's great and exporting works well in all scenarios except one. We have a donut chart with two levels. When it is rendered in the browser it shows up fine:
If you now export this chart using the default highcharts service it shows a bit like this:
Anyone know why this is happening and if there is any way we can fix this?
I would recommend creating a fiddle of your problem, and emailing HighCharts support about it (or link the fiddle here), they are very helpful and usually respond quickly.
Your problem does however seem to be related to your code as I also generate and export donut charts with no problems
My mistake in the configuration was when I was dynamically updating the colour:
chart.series[0].data[s].update({color: "#FFFFFF")}, false);
This didn't just mean I was updating the color but also the whole point. This meant that by running the above I was running y to nothing! Although the chart displayed ok the data sent to the exporting service was with unset values for the slices.. hence the empty slices in the chart. to fix it I had to do something like:
chart.series[0].data[s].update({
color: "#FFFFFF",
y: chart.series[0].data[s].y,
name: chart.series[0].data[s].name,
)}, false);

Resources