This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How To Integrate Flot With Angularjs? |
|
Answer» Since charting involves heavy DOM MANIPULATION, directives are the way to go. Data can be kept in the Controller App.controller('Ctrl', function($scope) { And you can create a custom HTML tag1 SPECIFYING the model you want to get data from <chart ng-model='data'></chart> Since charting involves heavy DOM manipulation, directives are the way to go. Data can be kept in the Controller App.controller('Ctrl', function($scope) { And you can create a custom HTML tag1 specifying the model you want to get data from <chart ng-model='data'></chart> |
|
| 2. |
Is There A Way To Get/convert The Resultset In Exactly The Same Format As Is Required By The Series Property Of Highcharts? |
|
Answer» Not got a chance to run the code below, but this should work or something very similar to this $series=array(); An advice is to always STICK to json_encode() for doing the jsonification. You may want to go through this EXAMPLE on the reference page to learn about how json_encode works with arrays in PARTICULAR Not got a chance to run the code below, but this should work or something very similar to this $series=array(); An advice is to always stick to json_encode() for doing the jsonification. You may want to go through this example on the reference page to learn about how json_encode works with arrays in particular |
|
| 3. |
Highstock Highcharts Irregular Data Gets Wrong X-scale? |
|
Answer» You will need to set the XAXIS.ordinal property to FALSE, this is true by DEFAULT. True value indicates the points should be placed at FIXED INTERVALS w.r.t space (pixels), and False changes points to be placed at fixed intervals w.r.t. time xAxis: { You will need to set the xAxis.ordinal property to false, this is true by default. True value indicates the points should be placed at fixed intervals w.r.t space (pixels), and False changes points to be placed at fixed intervals w.r.t. time xAxis: { |
|
| 4. |
How To Use Json_encode? |
|
Answer» json_encode is a convenience METHOD to convert an array into JSON format. To have the output you provided, you will need an array of arrays. Each sub-array has KEYS "name" and "data", where "name" is the Item column, and "data" is another array containing values from 2011 and 2012. $RESULTS = mysql_query("..."); json_encode is a convenience method to convert an array into JSON format. To have the output you provided, you will need an array of arrays. Each sub-array has keys "name" and "data", where "name" is the Item column, and "data" is another array containing values from 2011 and 2012. $results = mysql_query("..."); |
|
| 5. |
Proper Way To Remove All Series Data From A Highcharts Chart? |
|
Answer» This to REMOVE all chart SERIES, while(chart.series.length > 0) This to remove all chart series, while(chart.series.length > 0) |
|
| 6. |
How Can I Get Access To A Highcharts Chart Through A Dom-container? |
|
Answer» USERS can use the highcharts plugin VAR chart=$("#container").highcharts(); Read from the Highcharts.charts array, for version 2.3.4 and later, the INDEX of the chart can be found from the data on the DIV var index=$("#container").data('highchartsChart'); Users can use the highcharts plugin var chart=$("#container").highcharts(); Read from the Highcharts.charts array, for version 2.3.4 and later, the index of the chart can be found from the data on the div var index=$("#container").data('highchartsChart'); |
|
| 7. |
How To Get Highcharts Dates In The X Axis? |
|
Answer» Highcharts will automatically try to find the best format for the current zoom-range. This is done if the xAxis has the TYPE 'datetime'. Next the unit of the current zoom is calculated, it could be one of: This unit is then used find a format for the axis labels. The default patterns are: second: '%H:%M:%S', If you want the day to be part of the "hour"-level labels you should change the dateTimeLabelFormatsoption for that level include %d or %e. These are the available patters:
Highcharts will automatically try to find the best format for the current zoom-range. This is done if the xAxis has the type 'datetime'. Next the unit of the current zoom is calculated, it could be one of: This unit is then used find a format for the axis labels. The default patterns are: second: '%H:%M:%S', If you want the day to be part of the "hour"-level labels you should change the dateTimeLabelFormatsoption for that level include %d or %e. These are the available patters: |
|
| 8. |
How To Add Items To An Array Dynamically In Javascript? |
|
Answer» $(function() { $(function() { |
|
| 9. |
I'm Using Highcharts Column Chart And I Want It To Be 100% Width Responsive Chart. The Container Is A Simple With No Any Formatting. When The Document Loads, The Chart Is Always Fixed Width 600x400px Size. If I Resize Window Or Switch To Another Browser Tab, The Chart Fills The Width And Becomes Responsive Full Width Chart Just Like I Wanted. If I Reload Page, It's Fixed Width Again. I Tried Setting Width To Both Container And Chart, However, Nothing Helps. If I Move The Container Div One Level Above The Parent Div, It Works. How To Make The Chart Become Full Width On Page Load Also? |
|
Answer» Chart's width is TAKEN from jQuery.width(CONTAINER), so if you have chart in some hidden TABS or something similar, width will be UNDEFINED. In that case default width and height are set (600x400). Chart's width is taken from jQuery.width(container), so if you have chart in some hidden tabs or something similar, width will be undefined. In that case default width and height are set (600x400). |
|
| 10. |
What I'd Like To Do Is To Create A Link That Saves The Image On The Server, Instead Of Downloading It. How Could I Do That ? |
|
Answer» It could be DONE really EASY with PhantomJS. You can render Highchart CHART and SAVE it to SVG, PNG, JPEG or PDF. It could be done really easy with PhantomJS. You can render Highchart chart and save it to SVG, PNG, JPEG or PDF. |
|
| 11. |
I Have A Column Chart Which Has A Number Of Categories, Each With A Single Data Point (e.g. Like This One). Is It Possible To Change The Color Of The Bar For Each Category? I.e. So Each Bar Would Have Its Own Unique Color Rather Than All Being Blue? |
|
Answer» You can also SET the color INDIVIDUALLY for each point/bar if you change the DATA array to be CONFIGURATION OBJECTS instead of numbers. data: [ You can also set the color individually for each point/bar if you change the data array to be configuration objects instead of numbers. data: [ |
|
| 12. |
Is There Any Way To Pass Some Additional Data To The Series Object That Will Use To Show In The Chart 'tooltip'? |
|
Answer» Yes, if you set up the series object like the FOLLOWING, where each data point is a hash, then you can pass extra VALUES: new Highcharts.Chart( { Yes, if you set up the series object like the following, where each data point is a hash, then you can pass extra values: new Highcharts.Chart( { |
|
| 13. |
Why Are Bootstrap Tabs Displaying Tab-pane Divs With Incorrect Widths When Using Highcharts? |
|
Answer» The problem is that Highcharts can not calculate width of the CONTAINER which has CSS: display:none, so applied is default width (600px). In FACT, browser is not able to calculate width for such elements. For example when you will use separator to resize Result WINDOW, CHART will resize and will work. So you have three options:
The problem is that Highcharts can not calculate width of the container which has CSS: display:none, so applied is default width (600px). In fact, browser is not able to calculate width for such elements. For example when you will use separator to resize Result window, chart will resize and will work. So you have three options: |
|
| 14. |
Your Map Of My Country Does Not Include A Disputed Area? |
|
Answer» We do our BEST not to take sides in border conflicts, however we realize the need for MAPS INCLUDING DISPUTED areas. To solve this, we try to keep our default maps conforming to neutral de facto borders or conventions, while providing alternative maps that include disputed areas. We do our best not to take sides in border conflicts, however we realize the need for maps including disputed areas. To solve this, we try to keep our default maps conforming to neutral de facto borders or conventions, while providing alternative maps that include disputed areas. |
|
| 15. |
How Do I Add Data From A Mysql Database? |
|
Answer» Highcharts RUNS on the client SIDE only, and is completely ignorant of how your server is set up. This means that if your server is running PHP and MySQL, or any other type of server technology coupled with any SQL engine, you can dynamically produce the HTML and JavaScript required by Highcharts. There are a number of ways to do this. One way is to make a SPECIFIC PHP file that only contains the data, call this dynamically from jQuery using Ajax, and add it to the configuration object before the chart is generated. Or you can have one PHP file that returns the entire JavaScript setup of your chart. Or, in the most basic way, just add some PHP code within your parent HTML page that handles the data from the chart. Below is a basic, LOW level example of how to pull data from a MySQL table and add it to your chart. Highcharts runs on the client side only, and is completely ignorant of how your server is set up. This means that if your server is running PHP and MySQL, or any other type of server technology coupled with any SQL engine, you can dynamically produce the HTML and JavaScript required by Highcharts. There are a number of ways to do this. One way is to make a specific PHP file that only contains the data, call this dynamically from jQuery using Ajax, and add it to the configuration object before the chart is generated. Or you can have one PHP file that returns the entire JavaScript setup of your chart. Or, in the most basic way, just add some PHP code within your parent HTML page that handles the data from the chart. Below is a basic, low level example of how to pull data from a MySQL table and add it to your chart. |
|
| 16. |
How Do I Define Irregular Time Data? |
|
Answer» To add data POINTS with irregular INTERVALS, instead of defining pointStart and pointInterval for the series, DEFINE an X value (date) for each point. If you want the line to be broken for missing DATES, insert null values instead. To add data points with irregular intervals, instead of defining pointStart and pointInterval for the series, define an X value (date) for each point. If you want the line to be broken for missing dates, insert null values instead. |
|
| 17. |
Can I Generate Charts On The Server Without Using A Browser? |
|
Answer» There are also other approaches for server-side chart generation:
There are also other approaches for server-side chart generation: |
|
| 18. |
My Non-english Characters Don't Display Right In My Charts |
|
Answer» If you're using GERMAN umlauts, Scandinavian vowels or non-European ALPHABETS, you need to use UTF-8 encoding for your FILES. There are two ways of doing this.
If you're using German umlauts, Scandinavian vowels or non-European alphabets, you need to use UTF-8 encoding for your files. There are two ways of doing this. |
|
| 19. |
Can I Export Multiple Charts To The Same Image Or Pdf? |
|
Answer» CURRENTLY this isn't implemented in the core, but there are a couple of paths you can go to ACHIEVE this.
Currently this isn't implemented in the core, but there are a couple of paths you can go to achieve this. |
|
| 20. |
How Can I Get The Best Performance Out Of Highcharts? |
|
Answer» When working with series with a high number of data points, there are a few things to consider.
When working with series with a high number of data points, there are a few things to consider. |
|
| 21. |
Can I Add A Data Table To The Exported Chart? |
|
Answer» Yes, with a LITTLE PROGRAMMING on top of the Highcharts DATA and drawing API you can draw a table. Yes, with a little programming on top of the Highcharts data and drawing API you can draw a table. |
|
| 22. |
Can I Use Features From Highstock In Highcharts? |
|
Answer» Yes, most HIGHSTOCK features can be applied to standard charts. From a licensing point of view, using features of the STOCK package obviously requires a Highstock license. Technically Highcharts Stock is implemented as a set of plugins for Highcharts. The entire code base for Highcharts is included in the Stock package, and you can invoke a chart using Highcharts.Chart and enable CERTAIN features that are normally associated with a stock chart. Examples:
Yes, most Highstock features can be applied to standard charts. From a licensing point of view, using features of the Stock package obviously requires a Highstock license. Technically Highcharts Stock is implemented as a set of plugins for Highcharts. The entire code base for Highcharts is included in the Stock package, and you can invoke a chart using Highcharts.Chart and enable certain features that are normally associated with a stock chart. Examples: |
|
| 23. |
Can I Use Highcharts With A ... Server? |
|
Answer» Highcharts runs entirely on the client, and works with any web server that can deliver HTML and JavaScript content. Whether your server is PHP, Perl, ASP, ASP.NET, Node.js or whatever, Highcharts is completely ignorant of it. The HTML/JavaScript files may also be loaded from the file system, which is the case in app platforms where Highcharts is loaded in a web component inside the app. The best practice in integrating Highcharts may differ from system to system. You should follow the common practice for handing JavaScript on your specific system. Some prefer to serve a clean JSON or JavaScript file with the Highcharts setup, others to write the JavaScript setup DIRECTLY to the web page. DATA can be loaded in form of JSON or CSV files (see Working with data in the left MENU), or printed inline in the chart setup. When working with a databased powered backend, it may be cleaner to have your server system serve JSON or CSV files. Highcharts runs entirely on the client, and works with any web server that can deliver HTML and JavaScript content. Whether your server is PHP, Perl, ASP, ASP.NET, Node.js or whatever, Highcharts is completely ignorant of it. The HTML/JavaScript files may also be loaded from the file system, which is the case in app platforms where Highcharts is loaded in a web component inside the app. The best practice in integrating Highcharts may differ from system to system. You should follow the common practice for handing JavaScript on your specific system. Some prefer to serve a clean JSON or JavaScript file with the Highcharts setup, others to write the JavaScript setup directly to the web page. Data can be loaded in form of JSON or CSV files (see Working with data in the left menu), or printed inline in the chart setup. When working with a databased powered backend, it may be cleaner to have your server system serve JSON or CSV files. |
|
| 24. |
My Charts Are Not Showing In Internet Explorer 7 Or 8? |
|
Answer» The most COMMON REASON why a chart works in modern browsers but fails in IE6, 7 and 8, is stray commas in the configuration options. Stray commas are commas after the last item of an object or an array in JavaScript. These will pass silently in modern browsers, but cause a JavaScript ERROR in legacy IE. var chart = new Highcharts.Chart({ Another case where legacy IE fails to show charts, is when the security setting "ACTIVEX controls and plug-ins" => "Binary and script behavious" is disabled. This happens very rarely on user computers, but we have seen it from time to time on company networks. In this case, IE fails to draw any of the vector graphics, only the the text is shown. The most common reason why a chart works in modern browsers but fails in IE6, 7 and 8, is stray commas in the configuration options. Stray commas are commas after the last item of an object or an array in JavaScript. These will pass silently in modern browsers, but cause a JavaScript error in legacy IE. var chart = new Highcharts.Chart({ Another case where legacy IE fails to show charts, is when the security setting "ActiveX controls and plug-ins" => "Binary and script behavious" is disabled. This happens very rarely on user computers, but we have seen it from time to time on company networks. In this case, IE fails to draw any of the vector graphics, only the the text is shown. |
|
| 25. |
Does Highcharts Refer To Files Outside Our Domain? |
|
Answer» For basic usage, Highcharts doesn't refer to any files other than highcharts.js/highstock.js, though there are some cases that you should be aware of.
For basic usage, Highcharts doesn't refer to any files other than highcharts.js/highstock.js, though there are some cases that you should be aware of. |
|