JfreeChart and ValueMarker not displayed (headless environment) - jfreechart

I have a problem while generating a chart. Every part on the chart is well generated except a ValueMarker which is not. I am working on a web application in a headless RedHat environment. I got another problem for the chart generation (which is now solved), the description of my environment is here :
JFreeChart strange rendering (headless RedHat)
It is working perfectly on Windows.
The piece of code adding the ValueMarker is :
Marker distanceTiers = new ValueMarker(Double.parseDouble(resultDistance.replace(Constants.UNITE_DISTANCE, "")));
distanceTiers.setPaint(Color.BLACK);
plot.addDomainMarker(distanceTiers);
Here is what I obtain, I am supposed to get a vertical line at X = 40 and I cannot figure out why everything except this line is going well :
If someone has an explanation for this, please do not hesitate.

It's not clear where you get the domain value used to construct the ValueMarker, but you might compare your approach to that shown in this Q&A

Related

How to web scraping Highcharts values?

I'm trying to get data from a Highchart, but I only have a "None" value.
The chart needs a password to be accessed, but I have the same problem with the chart on this page.
Using the browser's DevTools I can get the y value from highchart using:
Highcharts.charts[0].series[0].data[0].y
Thus, combining this code with a loop structure I can have all the y values.
The problem is when I try to use Selenium to webscraping those values. I'm using the code below
page.execute_script('Highcharts.charts[0].series[0].data[0].y')
The answer I expect is 2 (as in DevTools), but instead I'm getting "None" as answer.
I already tried to use Beautifulsoup to retrieve the y value from the <path> tag, but it doesn't meet the expected value.
The HTML source seems to be complex (I'm not expert in these area). The full xpath of the <svg> is:
/html/body/form/div[3]/div[2]/div[2]/section/div/div/div[2]/div/section/div/div/div/div[2]/div[2]/div[1]/div[2]/div/div/svg
Also, I can't find any <iframe>, which could be avoiding me from accessing the graph.
Does anyone knows what I'm doing wrong? (I'm beginner in this area, so let me know if any further information is necessary)
After a long time stuck in it, I figured out how to solve this problem.
My mistake is that I was sending to my browser, via selenium, the js script below to be executed.
page.execute_script('Highcharts.charts[0].series[0].data[0].y')
This code is working perfectly but it doesn't return to me any value. So, in order to have the y value (that is what I need), I just need to use a "return" in the previously code. The final code is
page.execute_script('return Highcharts.charts[0].series[0].data[0].y')

PDFJS: Text layer rendering twice

Here's the context:
pdfjs-dist: v2.2.228
angualar/core: 8.2.0 (hybrid Env with an AngularJs 1.5.X)
Objective: to upgrade pdfjs-dist to the latest versions (2.3.200 or at least 2.2.X)
I upgraded from pdfjs-dist 2.0.4xx, and here's what is being rendered:
So basically, instead of having the PDF rendered correctly, with highlightable text and so on, there's like a duplicate of the text: one version of the text is rendered correctly (graphically), the other version seems to work OK for text selection and searching.
When doing any search, PDFFindController works on the highlightable layer (as you can see the area with the greenish text in the upper part of the image).
Any idea what might cause this behavior?
this is due to the new update of PDFjs requires css file to style the pdf.
you can get more details on this from the following question's answer
PDFJS: error on Text rendering for the PDF

Creating a responsive barchart in amchart v4

So I read on the docs that responsiveness for amchart 4 is still currently under development, and so perhaps that explains my difficulties here.
I'm trying to create a barchart that will shrink properly without distorting how the data is displayed. I've tried shrinking the parent container with an #media rule, but that distorted the data.
What's happening: When I shrink the view (i.e. open up inspector or run the web app on a smaller machine) half the category labels on the X-axis are disappearing for some strange reason. It seems to be every other label exactly is gone.
I've tried setting:
categoryAxis.minWidth = 0;
As an approximation of v3's minHorizontalGap property but of course they aren't the same.
I've tried setting the column width in hoped that that would influence the labels.
series.columns.template.width = am4core.percent(50);
And finally I've tried setting both the whole chart to responsive, and the categoryAxis:
categoryAxis.responsive.enabled = true;
But doing this gives me the following error which I can't find support for online:
bootstrap:114 Uncaught (in promise) Error: Loading chunk vendors~responsivedefaults failed.
I'm not sure what the problem is or how to resolve it, I can't believe they'd release a version of amcharts that didn't have responsivity in this age, and so I think it has to be something I'm doing wrong.
So I found the v4 equivalent to minHorizontalGap and that has solved the problem for me.
categoryAxis.renderer.minGridDistance = 60;
It's as simple as that. I still don't know why responsive.enabled doesn't work, but this is a satisfactory solution.

Cefsharp and video tag WebRTC

I'm trying to write a wpf with webrtc support. The access to the camera works but the display of the <video> from the page doesn't. Can anyone help?
You can do something like this:
var cefSettings = new CefSettings();
cefSettings.CefCommandLineArgs.Add("enable-media-stream", "enable-media-stream");
Cef.Initialize(cefSettings);
This has the same effect as passing the command line argument
I assume you want to display video from your camera via WebRTC so I think it requires a call to .getUserMedia() to get hold of your camera. For that to work you must use CefSharp based on Chromium 30 or later. So either:
Use the latest CefSharp.Wpf NuGet. Right now you need latest -Pre release
or build from source with the current master branch.
I just did a quick test again using CefSharp.MinimalExample so here are the steps:
Make sure your MinimalExample uses Chromium 31 or higher - see this PR - unless it already got merged by the time you are reading this.
In MainView.xaml modify the <cefSharp:WebView Address= /> attribute to "https://simpl.info/getusermedia/sources/index.html"
Build and when running add the --enable-media-stream command line flag.
That's it! With your camera connected and a bit of luck you should see your own face - or whatever the camera points to - on the screen.
Bonus info: Hopefully soon PR #365 can get a bit of extra love to allow for passing flags too and get merged into CefSharp. With that you can set the flag in code instead of having to pass it in as a command line parameter.
The correct code is this
Dim settings As New CefSettings settings.CefCommandLineArgs.Add("--enable-media-stream", "1") CefSharp.Cef.Initialize(settings) settings.CachePath = "cache"

Extjs 4: Time Stacked Bar Chart, possible?

Hi I'm trying to accomplish a time stacked bar chart where the input data looks like this:
{"name":"Folienwechsel",
"starttime":"02/29/2012 09:50:07",
"endtime":"02/29/2012 09:50:46",
"duration":38546.0},
{"name":"Pause",
"starttime":"02/29/2012 09:50:46",
"endtime":"02/29/2012 09:51:36",
"duration":49943.0},
{"name":"Wartezeiten",
"starttime":"02/29/2012 09:51:36",
"endtime":"02/29/2012 10:04:43",
"duration":787086.0}
As you see the start time and end time are continued, when a state finish the other one starts, I've been trying with the timeaxis, based on this tutorial http://aboutfrontend.com/extjs/extjs...-and-timeaxis/, and also with the stackbar example in sencha http://docs.sencha.com/ext-js/4-0/#!...tackedBar.html. An image example of what I'm trying to do:
I already done this with HighChart, but my company has bought ExtJs then I need to do this with Extjs, then it would be great if someone can tell me if its possible, and if it is, then if could guide me with an example or how should I start...
Thanks.
I spent some time working with time based charts in ExtJs4 and I have to warn you - that TimeAxis is buggy. I even had to replace my time axes with simple numeric ones. The idea is simple - convert your dates into the timestamps and pass them to your numeric axis.
Stackbar chart is a good choice for you. See this example (modified a bit), from official sencha examples:
http://jsfiddle.net/UDwz7/

Resources