score:42
With require.js 2.1.0+ a plugin is not necessary. You can include Highcharts with a shim:
require.config({
paths: {
require: "libs/require",
jquery: "libs/jquery",
highcharts: "libs/highcharts"
},
shim: {
highcharts: {
exports: "Highcharts",
deps: ["jquery"]
}
} // end Shim Configuration
});
score:1
I just got it to work as follows:
Add this at the top:
define(['jquery'], function (jQuery) {
Add this at the very end:
return window.Highcharts; });
This assumes you have jquery already defined, eg
require.config({
paths: {
'jquery': '//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min'
}
});
You can follow this general approach for most third party libraries. For example, I did this for jquery.tmpl.js and knockout.js.
score:1
Using the recent use.js plugin is definitely the way to go. Editing third party libs as suggested in my previous answer is a pain for maintainability.
score:1
A minimal example of a recent approach for Highcharts with a module (JSFiddle example):
require.config({
paths: {
highcharts: "https://code.highcharts.com/highcharts",
highcharts_exporting: "https://code.highcharts.com/modules/exporting"
}
});
require(['highcharts', 'highcharts_exporting'], function(Highcharts, exporting) {
exporting(Highcharts); // We need to initialize module files and pass in Highcharts
Highcharts.chart('container', {
series: [{
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}]
});
});
See this Highcharts documentation for a usage description.
Source: stackoverflow.com
Related Query
- Loading Highcharts with require.js
- Loading multiple Highcharts with jquery.load
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts async Server Loading with multiple series
- Loading 'theme' and 'exporting' module with Highcharts using Requirejs
- Jquery Highcharts is not loading when using with common function?
- passing formatting JavaScript code to HighCharts with JSON
- Highcharts loading data from a HTML table with a title
- highcharts Scatter Chart not loading with LOTS of data
- loading highcharts with data from database
- Highcharts series visibility with csv data source
- Loading json data to highcharts with multiple series
- How to have multiple highcharts with different series data in vuejs without repeating code
- Multiple charts with same data not loading in same page: Highcharts
- Highcharts Windbarb with ajax data loading
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- Server-side c# and client side javascript with json loading Highcharts gantt chart Task Progress Indicator, need to change Tooltip and Label name
- Highcharts cloud issue with data source when duplicating chart
- Getting numbers on Y-axis to show up as percentages with code from a Highcharts code generator tool?
- No results in Highcharts with loading from JSON
- Highcharts loading all data with xaxis simplified
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Loading multiple variables using Highcharts and jquery with php
- Server side chart .svg export with Highcharts and PhantomJS, error loading data from .csv file
- Reload chart data via JSON with Highcharts
- Highcharts - how to have a chart with dynamic height?
- Resize height with Highcharts
- Styling bar colors in Highcharts with a gradient issue
- How to use highcharts with angular 5?
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
More Query from same tag
- How to move tooltip position in Highchart?
- Why highstock charts have two yAxis?
- Highcharts Resetting Drilldown (three layers) to Initial state
- Technique to use to reduce the number of javascript lines to write
- R - Highcharter how to add horizontal dashed line?
- php-fed Highcharts time series throws T_variable error, why?
- How to remove default Hover text and display the custom text title on hover Donut chart Highcharts
- Can I use iron-localstorage and iron-ajax with highcharts
- Highchart / Easyphp / Batik
- How to move point's label and SVGs by moving a point graphic in highcharts gantt?
- Line not show properly while exporting HTML to PDF using wkhtmltopdf
- Highcharts tooltip formatter using jquery replace
- highcharts how to hide legendSymbol in front of particular legend name?
- child_process.execFile is not working with phantomjs and highcharts-convert.js
- Highcharts : How to apply style to x-axis Labels?
- Using redux data in JS object
- Highcharts pie spacing title - chart - legend
- How to make a Highcharts semi-circle donut chart using Hightchart-ng
- Multiple different chart types stacked, column type with y value as color
- Put two Highcharts Charts Side by Side on a Jekyll Blog (beautiful-jekyll)
- highcharts, Set minimum height for stacked column chart?
- Highcharts Pie Chart turning off data label
- How can i change the color of a tile which was clicked of a treemap in highcharts using react
- Highcharts - export current state of a chart
- Group by month to plot on R with Highcharter
- Adding area gradient to line highchart
- Get Highchart (/ Highstock) from public data (json)
- Highstock tooltip.positioner isn t working
- Highcharts: series gaps for "columnrange"
- enable scroll for high chart,high stock