Exporting multiple HighCharts visualizations to PowerPoint presentations

Our team is preparing to create an Angular-based web application featuring 15-20 unique charts utilizing HighCharts. One of the key requirements is the ability to export these charts into PowerPoint slides.

We are aware that HighCharts offers an option to export images. We plan to utilize a Ruby gem for embedding these exported images into PPT presentations, although there is also a Node module available for this purpose if needed.

However, the main challenge lies in the client's request for all graphs to be downloaded as a single PPT file with just one click, without any prior rendering of the charts by HighCharts when the button is clicked.

Question: Is there a way to export all these unrendered charts (with data retrieved from APIs) into images with a single click?

We have brainstormed a few potential solutions: 1. Load all charts but keep them hidden. Trigger the HighCharts export function invisibly upon click, download all images, and then embed them in a PPT. [This method may not be efficient, especially for large graphs that could slow down page loading.]

  1. Utilize a headless browser to pseudo-render and export the charts as images before embedding them in a PPT. PhantomJS was suggested by some experts, though our concerns include authentication issues and re-login requirements with a headless browser.

  2. Explore options for offline conversion and sending the PPT via email, although implementation details remain unclear at this stage.

If anyone has experience with or suggestions regarding this process, we would greatly appreciate your insights.

Answer №1

If you want to enhance your initial solution, here's a suggested approach:

  • Start by collecting options for Highcharts charts on the client side
  • Send AJAX requests to the Highcharts server with the chart options; in return, you will receive either a base64 image or a URL pointing to the image on the server
  • Once all the data is returned from the Highcharts server, use another AJAX request to post the URLs/images to your backend
  • In your backend (whether it's Ruby, nodeJS, or any other language), gather these images and compile them into a PowerPoint presentation

For an example implementation of the first three steps, you can refer to this simple code snippet: http://jsfiddle.net/3dptu2s3/

Below is the code snippet for handling basic options (Note: there's no need to load the Highcharts library):

  • Basic chart options:

    var chartOptions = {
        exporting: {
            url: 'http://export.highcharts.com/'
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    };
    
  • Exporting logic:

    var obj = {
            options: JSON.stringify(chartOptions),
            type: 'image/png',
            async: true
        },
        exportUrl = chartOptions.exporting.url,
        imgContainer = $("#container");
    
    var calls = [];
    
    for (var i = 0; i < 4; i++) {
        calls.push({
            type: 'post',
            url: exportUrl,
            data: obj,
        });
    }
    
    $.when(
        $.ajax(calls[0]),   
        $.ajax(calls[1]),
        $.ajax(calls[2]),
        $.ajax(calls[3])
    ).done(function (c1, c2, c3, c4) {
        var urls = [];
        $.each(arguments, function(i, chart) {
            urls.push(exportUrl + chart[0]);
            /*
                Here you can send URLs to the backend:
                $.post("url/to/backend", urls, function(data) {
                    console.log(data);
                })
            */
        });
    });
    

Just a note, if needed, you can make AJAX calls directly from your backend without involving the frontend.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to disable map zoom controls in react-leaflet

Currently, I am developing a react-leaflet application project and facing an issue with separating the zoom control from the map itself. This is a similar concern that was addressed in a vanilla Leaflet context on this link. Now, I am attempting to achieve ...

Error: Invalid character encountered during login script JSON parsing

I found this script online and have been experimenting with it. However, I encountered the following error: SyntaxError: JSON.parse: unexpected character [Break On This Error] var res = JSON.parse(result); The problem lies in the file below as I am unf ...

Organizing a mat-table by date does not properly arrange the rows

My API retrieves a list of records for me. I would like to display these records sorted by date, with the latest record appearing at the top. However, the TypeScript code I have written does not seem to be ordering my rows correctly. Can anyone assist me ...

jQuery failing to trigger onClick event for a specific group of buttons

Javascript: <script> $(document).ready(function(){//Implementing AJAX functionality $(".acceptorbutton").on('click', function(){ var whichClicked = this.attr('name'); ...

The TypeScript datatype 'string | null' cannot be assigned to the datatype 'string'

Within this excerpt, I've encountered the following error: Type 'string | null' cannot be assigned to type 'string'. Type 'null' cannot be assigned to type 'string'. TS2322 async function FetchSpecificCoinBy ...

Positioning the Angular material menu (notification bar)

I am in the process of developing a notification bar that will appear on the bottom left of the bell icon when it is clicked. For an example, you can visit this link: I attempted to set a specific margin-top (140px), but encountered an issue where the no ...

Implement jQuery Tabs in Brackets software to enhance user experience

My Adobe Creative Cloud subscription is expiring soon, and I am considering switching to Brackets, an open-source code editor developed by Adobe. However, I am facing some difficulties adding jQuery tabs to my HTML documents. I downloaded the 1.10.4 zip f ...

Steps to retrieve an incorrect fruit when it is located as the initial item within the array

Currently tackling the precourse material for a coding bootcamp and hitting a roadblock with this particular question. Despite my best efforts, I just can't seem to meet one of the 7 conditions required. Let me outline the question, my attempted solut ...

Unable to perform a fetch request in IE9 after the page has finished loading

I'm currently encountering an issue with my Node and Express server setup. I have a separate API on a different server that needs to be accessed, but everything works fine except in IE9. The problem arises when I try to make a call to the API after lo ...

AngularJS secondary controller experiencing malfunctions

Having an issue with my second controller (RegisterController) in the module I've created. The first one is working perfectly fine. I have both controllers in a file named user.js var app = angular.module("User", []); app.controller('LoginCont ...

Using React Bootstrap, you can ensure that only a single collapse opens at a time when rendering it with a map function. This allows you to display

When a user clicks on the "View Tasks" button, I want to display the relevant tasks specific to that user. However, currently all React Bootstrap Collapse Components open up and show tasks for every user instead of just one. This issue arises because the o ...

How to Trigger a Callback Function in Angular Template?

Within my directive for tables, I have the ability to output values based on specific properties. For example: <tr ng-repeat="item in table.data"> <td ng-repeat="column in table.columns"> <i ng-if="column.type === 'icon&apo ...

The strategy of magnifying and shrinking graphs on Google Finance for better analysis and

I am seeking to understand the logic behind a zoom-able graph similar to the one on Google Finance. I am aware that there are pre-made components available, but I am interested in a simple example that breaks down the underlying logic. ...

Access to a custom Google Map via an API connection

I currently have multiple custom Google Maps that I created using and they are all associated with my Google account. Is it possible to access these maps using the Google Maps JavaScript API? It seems like the API does not work with manually created maps ...

Looking for guidance on utilizing pushState and handling onpopstate events?

By using ajax, I am able to load specific page content without refreshing the entire page. In order to make the back button functionality work, I utilize pushState and onpopstate as shown below: function get_page(args){ .... $.ajax({ url ...

Changing a callback function into a promise in Node.js for OpenTok integration

MY FUNCTIONAL CODE (SUCCESSFULLY WORKING!) I have developed a function with callback to generate tokens and create sessions for OpenTok. This function is then exported to the application. The function //Dependencies var opentok = require('./ot&ap ...

Utilizing Zend JSON encoding for seamless integration with JavaScript

I'm currently working with the Zend Framework. My objective is to pass JSON data from the controller to JavaScript. I have a simple array: $array = array('a' => 1, 'b' => 2); After encoding this array into JSON format: ...

Is it possible to customize the width of text color alongside a progress bar?

My Bootstrap 4 Website contains the following HTML code snippet: <div class="container"> <div class="row"> <div class="col-md-6 mx-auto> <h2>Example heading text</h2> <h6>Example subh ...

When I use .fadeToggle, my div transitions smoothly between visible and hidden states

Looking to create a sleek navigation menu that showcases a colored square when hovered over? I'm currently experiencing an issue where the squares are not aligning correctly with the items being hovered. Switching the position to absolute would likely ...

Solving yarn conflicts when managing multiple versions of a package

My software application contains a vulnerability related to a package that has different versions available (1.x, 2.x, 3.x). Since many other packages rely on this particular one as a dependency, updating each one individually is not a viable solution at t ...