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,
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.
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.
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
I need to calculate the image width and height from the actual image file, so I'm reading the image with open file. so I have bunch of characters and numbers and everything that seems meaningless and they are presenting rgb information probably.
I just want to calculate the size of the image with the raw file information
I am programming in Erlang language but the code in any language will help as we are working with raw file as long as we don't use built-in libraries.
Thank you all in advance for help
I found the answer by going to details of each format,
So it works like this
JPG : you can find the width and height after the bytes "255,192,0,17,8" after that its the information for size
PNG : you can find it after "IHDR"
GIF : you can find it after "GIF89a"
there are information for more but this is the most common image types on internet
Thank you all for your time
I assume when you say 'raw' you mean you only have the pixel values.
In this case there isn't always a way to know the width and height.
Say you read 400 pixels. In this case a valid image side may be any whole factorization of 400, e.g. 1x400, 2x200, 4x100, 8x50, 20x20 etc. and transposed as well.
Not to mention the fact that many image formats include some padding for pixel rows that are not multiples of 4, 8 or 16...
The way it is coded in the image file depend on the image type, which hopefully is also coded in the image file. you can have a look at the question Getting Image size of JPEG from its binary for an example with JPEG coding.
If your data is unknown, use Octave and load the image. Then take a look at this page:
http://www.gnu.org/software/octave/doc/interpreter/Displaying-Images.html
for commands to display images. Hopefully with some manipulation it will work. This works for raw images, though there are specific decoders. Once you understand how the image is, you can write the equivalent C code.