score:2
Update - The Definitely Typed Highcharts definition now has my fix, so you can download the latest version and hopefully it will solve your problem.
The type definition for Highcharts suggests you need to pass amd array of options to yAxis. This compiles in TypeScript.
var chart = new Highcharts.Chart({
yAxis: [{
labels: {
formatter: function (): string {
return 'My Label';
}
}
}]
});
However, I'm not sure this matches the documentation, which suggests you pass the yAxis options as an object, not as an array of many of these objects. This also makes sense from the point of view that you have a single yAxis.
To achieve what I believe is the valid version (i.e. not arrays):
/// <reference path="highchart.d.ts" />
var yearChartOptions: HighchartsOptions = {
yAxis: {
plotLines: {
label: {
formatter: function (): string {
return '$' + Highcharts.numberFormat(this.value / 1000, 0) + 'k ';
}
},
}
}
};
// Create the chart
var yearChart = new Highcharts.Chart(yearChartOptions);
You can adjust your highchart.d.ts file here...
interface HighchartsOptions {
chart?: HighchartsChartOptions;
// others...
yAxis?: HighchartsAxisOptions; // <-- remove the [] from this line
}
I have submitted a pull request to Definitely Typed to fix this.
Fully working example based on your code:
Source: stackoverflow.com
Related Query
- Highcharts - Long multi-line y axis labels causing following label to be removed
- How to change axis label size when exporting in Highcharts / Highstock
- Highcharts axis label before first point
- Highcharts label format with tickPositioner in a datetime x Axis
- Highcharts show plot value on x axis label
- Highcharts x axis label text wrapping lost on setting label step
- How to position axis label in highcharts
- Axis Label Alignment in highcharts
- How do i add mouse wheel code in Angular2 highcharts in typescript
- Highcharts Omits X Axis Label
- Highcharts display label for pie chart using html table as data source
- Highcharts - Bar chart show full label on Y Axis
- Highcharts drilldown to pie chart - Clicking on axis label with multiple series causes pie charts to overlap
- Highcharts set X axis label on tick
- HighCharts Axis Label Encoding
- Avoid displaying y axis label and points when there is no data: HIghcharts
- Need to join x axis and y axis label highcharts
- highcharts y axis label with offset is hidden when chart has no title
- Highcharts repeating same label value on Y Axis
- Highcharts export customize axis label and fontsize: No effect after migration
- Change X axis label on Drill Down using HighCharts
- Format X axis Label of Highcharts
- How to show first and last label of x axis Highcharts
- X axis label in Highcharts graph in Django app
- Highcharts : trouble with axis Label
- Highcharts programmatically add extra text label to y axis
- X axis label as Category not showing correctly: Highcharts
- Highcharts : Display static Y axis labels from array when series data is null , else auto generated label
- Can i add two axis in a spiderweb highcharts and click x-axis label navigate to another page?
- How to set the width within axis label in highcharts
More Query from same tag
- Highcharts ; x-axis scaling issue
- Highcharts-vue - Calling my own tooltip label formatter function
- Referencing a JSON object created in Java through javascript in the one JSP page
- Highcharts bar chart tooltip HTML positioning
- How to put date into drilldown chart title based on drilled point x value (datetime)..?
- how to give click event in directive using angular js?
- Draw a vertical line when clicking on the series in highcharts.
- highchart dataLabel diffent position
- Step interval of "1" not working for me in Highcharts, why?
- Highcharts can not display ajax's return data
- How to force the display of every labels on yAxis in a BarChart
- Highstocks how to use hidden navigator with async loading
- Hide line in default state in Highcharts
- Highcharts : How to flag the local maxima on a dynamic graph drawn using HighChart
- Highstock Trigger javascript when range selector button clicked
- Pie Highchart Chart with multiple "ring's" around it
- Updating data in charts, highcharts with angular, highcharts-ng
- Highcharts - How do I move an icon inside each pie slice when the pie slice moves on hover?
- How create time line chat with selectable year dropdown
- coloring different parts of a series a different color
- Using Highcharts formatter causes Cannot read property 'length' of undefined
- How to set minimum height of data element of series in stacked bar chart?
- Summarize & Group By with Lodash
- Line chart legend color not getting update on button click (highcharts-angular)
- How can I make an AJAX request to a Highcharts rendering server running on a different port in production?
- Highcharts how to save a selected legend
- How to show open, close, high and low in tooltip when the chart type is 'line' in highstocks?
- PHP Outputing JSON file
- Using HIghcharts on Codeigniter to get data name and total
- Is there a style to apply that allows the legend to style each series as a button?