We started to use highcharts on server side. And I found a limitation of image width.
http://www.highcharts.com/component/content/article/2-news/52-serverside-generated-charts
width Set the exact pixel width of the exported image or pdf. This overrides the -scale parameter. The maximum allowed width is 2000px
Can it be changed in some config files or it's hard-coded thing. If so, why?
Thank you
You can changed in the ExportController.java file, in the Highcharts-export-web module.
Change this line here to alter the maximum allowed width.
It's not a bad idea to have this in a property file, but on the other hand, exporting images bigger than 2000px is also a bit rare.
Related
Is there a way in getting this sizes? Using command line. Thanks in advance. and can I ask something good tutorials in Dart?
I don't know a built-in feature that allows to do that except readying the content byte-wise and interpreting the values like explained for C++ in C++ How to get the Image size of a png file (in directory)
The image package seems to provide this functionality though. decodePng returns an image that has a width and height property.
The build-in function decodeImageFromList() can help you with that. Its callback contains an Image that includes the width and height.
I need to re-size image to any specific height and width value. But I'm not getting resized result. here is my code, please tell me either i'm doing something wrong or missing something.
IMOperation operationSmall = new IMOperation();
operationSmall.addImage("conf/error.png");
operationSmall.resize(300, 1000); // w*h
operationSmall.addImage("conf/errir_small.png");
Original Image size: 1280x960 px.
re-sized image size: 300x225
I tried to give different values, I'm only having issues in height.
their doc is not complete and no code example I find on internet except that using scale (it skip filtering) may solve this problem. but how to use scale in code I have not idea.
I don't read or understand java much, but at the command-line you need an exclamation mark to force ImageMagick to disregard aspect ratio and resize to exact/specific dimensions, like this:
convert -resize 300x200! image....
In the Java docs, there seems to be an option of adding a special 3rd parameter, so I guess you may need
operationSmall.resize(300,1000,'!');
or something similar... or maybe Java uses double quotes rather than the single quotes I suggested.
I'm looking for a way using the filepicker-rails gem to specify the image size. For example I would like to make it so my users cannot upload an image smaller than say 400 x 600 pixels.
Reading the docs I can only find the max file size in bytes, nothing about dimensions. Does anybody know how to accomplish this?
For now FilePicker API doesn't provide a feature of limiting files' sizes by dimensions (only by bytes as you have already mentioned).
What you could do is check the dimensions' of files and if they are lower than desired (400x600 in your case) then convert them to this minimum size using FilePicker's conversion feature.
Filepicker's new API has an option Image Dimensions where you can specify the height and width. With this local images with be upscaled or downscaled before the upload begins.
https://www.filepicker.com/documentation/file-ingestion/javascript-api/pick
Please check the specs and you-ll find out how to use the max_size :)
Playing around with HighChart, I am unable to make a user-friendly export, when i export my chart, all data are too compressed to be human readable,bar are too clause from each others. See image at bottom.
I have try to use ChartOption, export, width, scale, but didn't work at this time.
Can somebody propose me an idea?
You can define size (width,
height, scale) of your exporting file.
Ok i got it, As you said Sebastian Bochan we can play with the size in exporting option, but width, height, scale are usefull for resolution but it was not the real width of the exported img.
We have to use sourceWidth, because after digging in exporting.js I noticed that by default if exporting JS is unable to retrieve the size of a chart, it assume 600*600, that was my problem, and that's why my chart look compressed.
By explicitly defining the size with SOURCEWIDTH you can bypass this behavior, but i didn't find why exporting.js is unable to retrieve the original size by himself....
but now i have a full of beauty chart with 60 bar displayed over 1400px, i'm happy !
Thanks for your answer,
I have read the recent posts on the Highcharts.com website regarding their updated PhantomJS based exporting-server. I have also cloned their github repository and successfully compiled their web-service. However, all files produced by this server are marked as 96dpi, which is inadequate for my purposes. According to somewhat contradictory information on the Highcharts.com website (Here and Here), they are using Batik to rasterize PNG and JPG output, which should make it possible to adjust the DPI settings of the exported raster images. However, the pom.xml doesn't include any batik references and I can't find anything in the source code which indicates that anything other than PhantomJS is being used to produce the raster renditions. The PhantomJS export might be able to adjust the DPI, but I can only find the scale and width options which don't directly adjust the DPI, thus requiring a tedious post-processing rescale (or metadata edit) to adjust the DPI accordingly.
So, the meat of my question: how to adjust the exported DPI of a highcharts chart in PNG and JPG format when using the highcharts java exporting-server?
The release before the last one used both Batik and PhantomJS. The last release uses only PhantomJS. This is why you do not find any Batik references in the pom.xml anymore.
For controlling the dpi of the exported image. You should use the scale parameter. For completeness sake, here is how Highcharts determines the dpi of the exported image.
Controling the size of the exported image
Since Highcharts 3.0 and Highstock 1.3, the size of the exported image is computed based on a few rules:
If the exporting.sourceWidth and exporting.sourceHeight options are set, they take predence. This provides a convenient way of having separate sizes of the on-screen chart and the exported one.
If not, and the chart.width and chart.height options are set, those are used for the exported chart.
If a size hasn't been found yet, and the containing div has an explicit pixel width or height, that width or height is used. Percentage and other non-pixel widths will not take effect. This prevents a common pitfall in Highcharts 2, where charts with the typical 100% width would look out of proportion in export.
If a size still hasn't been found, it defaults to 600 by 400 pixels.
After rendering the chart width the above size, and all text sizes in relation to that, the actual image resolution is determined by exporting.scale which defaults to 2. In practice this means that a 600x400 chart will return an image of 1200x800 pixels by default. The rationale behind this is quite simple - if we used a scale of 1 and just set the sourceWidth to 1200 and sourceHeight to 800, all the text would become too small. And if we didn't scale it up, the resolution would be too small for print.
Read also here for more on the export server