Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the grid-line options explicitly in the Highcharts axis configuration, then make wkhtmltoimage wait until the chart has rendered before capturing the page. For reliable timing, set a readiness value in the chart’s load event and pass it to --window-status. If the chart uses styled mode, set the lines in CSS instead.

Set grid-line options in the Highcharts chart configuration

Gridlines belong to an axis, so configure them on xAxis, yAxis, or both. The key settings are gridLineWidth and gridLineColor; gridLineDashStyle lets you choose a line style. Setting a visible width and color explicitly avoids relying on theme defaults that may not suit the captured page.

Highcharts.chart('container', {
  xAxis: {
    gridLineWidth: 1,
    gridLineColor: '#d9d9d9',
    gridLineDashStyle: 'Solid'
  },
  yAxis: {
    gridLineWidth: 1,
    gridLineColor: '#d9d9d9',
    gridLineDashStyle: 'Solid'
  },
  series: [{ data: [1, 3, 2, 4] }],
  chart: {
    events: {
      load: function () {
        window.status = 'highcharts-ready';
      }
    }
  }
});

The example applies the same styling to both axes. If you want gridlines on only one axis, keep the options on that axis and remove them from the other. To make the lines more visible, adjust the color or width to suit the chart background and image size. Highcharts also provides corresponding minor-grid options when you need to style minor gridlines separately.

Check whether the page uses styled mode

In the regular configuration shown above, use the axis options. When chart.styledMode is enabled, style the grid lines with CSS instead. Highcharts identifies .highcharts-grid-line as the styled-mode selector; in that mode, CSS replaces gridLineWidth and gridLineColor as the styling mechanism.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.highcharts-grid-line {
  stroke: #d9d9d9;
  stroke-width: 1px;
}

Put the rule in a stylesheet loaded by the page before capture, or in an existing style block. If it has no effect, confirm that styled mode is actually enabled and that the selector is not being overridden by another rule.

Wait for Highcharts before capturing with wkhtmltoimage

Highcharts draws the chart with JavaScript. A capture taken before that code finishes can show an empty container or a chart without its final SVG. Enable JavaScript and wait for a specific page status when you control the page code:

wkhtmltoimage --enable-javascript --window-status highcharts-ready input.html output.png

The chart’s load handler sets window.status to highcharts-ready. The matching --window-status flag tells wkhtmltoimage to render after the page reaches that status. This is a useful deterministic gate when the page can set the value after the chart has loaded.

Use a delay if you cannot set a status

If the page is third-party content or otherwise cannot set window.status, use a JavaScript delay as a simpler fallback:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wkhtmltoimage --enable-javascript --javascript-delay 1500 input.html output.png

The 1500-millisecond delay is an example, not a guarantee that every chart will finish in that time. Choose a delay based on the page and environment, then check the resulting image. A fixed wait may be too short on a slow load and unnecessarily long on a fast one; a status gate is preferable when available.

The wkhtmltoimage manual also documents --run-script, --background, and --no-background. These are separate controls: --run-script can run page JavaScript, while the background flags control page-background painting. They do not replace setting the Highcharts axis options or waiting for the chart to finish.

Diagnose missing gridlines in the output

Use this sequence to isolate whether the problem is chart configuration, CSS, or capture timing:

  1. Confirm the chart code ran. Check that the Highcharts JavaScript files load before the code that calls Highcharts.chart. If the chart itself is absent, investigate script loading or page errors before tuning gridline styles.
  2. Make JavaScript explicit. Include --enable-javascript in the wkhtmltoimage command. Without the chart’s JavaScript execution, the capture cannot show the finished chart.
  3. Wait for rendering. Prefer --window-status with a readiness value set by the page’s chart load event. Otherwise, use --javascript-delay and verify that the chosen interval is long enough.
  4. Set visible axis values. Specify gridLineWidth and gridLineColor rather than depending on theme defaults. Add gridLineDashStyle when a particular dash style is needed.
  5. Match the styling method to the mode. Use axis options in regular mode; use .highcharts-grid-line CSS in styled mode. Check for conflicting CSS if the rule is present but the appearance does not change.
  6. Inspect the installed renderer if failures persist. There is no universal compatibility guarantee for every Highcharts and wkhtmltoimage build in the cited documentation. Test the specific installed versions and page rather than assuming that a successful render in another environment proves compatibility.

Common symptoms and fixes

What you see Likely cause What to try
Blank chart area JavaScript did not run, scripts did not load, or capture happened before rendering. Check script load order, enable JavaScript, and wait on the chart’s status value or a measured delay.
Chart appears, but no gridlines Gridline styling is not explicit, or the chart uses styled mode and is missing the CSS rule. Set the axis width and color, or use the styled-mode selector as appropriate.
Gridlines appear inconsistently A fixed delay may be shorter than the time this page takes to finish. Use a readiness status set after chart load if you control the page; otherwise measure a more suitable delay and validate the output.
Capture differs across environments The installed wkhtmltoimage build may not behave identically with the page’s Highcharts version. Reproduce with the exact installed builds and consider Highcharts’ own export tooling if the legacy renderer remains unsuitable.

When to use Highcharts export tooling instead

wkhtmltoimage captures a rendered web page. If your task is to export a Highcharts chart rather than reproduce an entire page, Highcharts offers its own export options. Its export module supports PNG, JPEG, PDF, and SVG output and exposes chart.exportChart() and chart.getSVG().

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For server-side automation, Highcharts documents a Node export server that accepts chart configurations or SVG and can create PNG, JPEG, PDF, or SVG output. Its command-line form is:

highcharts-export-server -infile chartConfig.json -outfile chart.png

Highcharts also states that local client-side exporting is the default from version 12.3.0 and can be changed with exporting.local. That behavior is distinct from wkhtmltoimage; check the export documentation for the Highcharts version you use before changing an existing workflow.

Consideration wkhtmltoimage Highcharts export tooling
What it renders A web page, useful when the capture needs surrounding page content as well as the chart. A chart configuration or SVG through the documented Node export server; Highcharts also exposes chart export methods.
Output formats documented here The cited wkhtmltoimage manual covers image capture and the timing/background flags; no complete format list is provided in that manual. PNG, JPEG, PDF, and SVG.
Asynchronous readiness Can wait for a page status or a JavaScript delay. The cited export references describe export methods and the command-line renderer; they do not establish the same page-status wait controls.
Compatibility and maintenance No universal compatibility guarantee for all Highcharts and wkhtmltoimage builds is established. Highcharts documents its own export path, including local client-side exporting by default from version 12.3.0; confirm behavior for the version in use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your chart is available at a URL, ScreenshotNeo can return a screenshot of that page with one GET request. Its API supports PNG, JPEG, WebP, or PDF output. The basic request below captures the page at https://stripe.com; replace that target with the URL of your chart page. See the ScreenshotNeo API documentation for setup and request details.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

For a Highcharts page that needs extra time or a specific readiness condition, configure the rendering options supported by ScreenshotNeo rather than assuming the simple request above uses the same status gate as wkhtmltoimage. Its available options include waiting for a selector, a delay, or network idle.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Cookie and consent banners are accepted before capture, and 60+ known consent platforms, newsletter popups, and chat widgets are removed; each step can be turned off.
  • Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Responses include X-Page-Verdict and X-Billed headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
  • The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

Sign up for ScreenshotNeo’s free plan to try capturing a chart page.

Practical reliability and cost considerations

For a local wkhtmltoimage workflow, capture reliability depends on correct script loading, a wait that matches when the chart is ready, and the behavior of the installed renderer. Validate the actual output image rather than treating a completed command as proof that the chart finished rendering correctly.

For an API workflow, use the response verdict and billing headers to distinguish a successful clean capture from a bot check, blank page, timeout, failed load, or cache hit. This is useful when handling captures programmatically because it lets an application inspect what happened instead of treating every response as an ordinary successful screenshot. ScreenshotNeo offers bulk capture of up to 100 URLs per call and caching with a configurable TTL; choose caching only when a stored result is acceptable for the page’s update frequency.

Frequently Asked Questions

Can I use the same gridline settings for both axes?

Yes. Put the same width, color, and optional dash-style settings under both xAxis and yAxis, as in the configuration example.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does a successful wkhtmltoimage command guarantee a complete Highcharts capture?

No. Validate the image: the command can finish even if the page scripts did not load correctly, the chart was not ready before capture, or the installed renderer behaves differently with your versions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.