potatoQuestions
potatoQuestions

Reputation: 13

Highcharts if title contains number it shows invalid data

Simple example from highcharts.com: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-parsed/

Here is the my version title with numbers: http://jsfiddle.net/948ws5k3/1/

basically just changed <th>Pears</th> to <th>Pears 222</th> and <th>Bananas</th> to <th>986</th> etc.

I need my table <th> to have numbers. How can this be done?

Upvotes: 0

Views: 77

Answers (2)

Nishith Kant Chaturvedi
Nishith Kant Chaturvedi

Reputation: 4769

If you remove space between text and number ,it will work fine

like instead

 <th>Pears 222</th>

use

 <th>Pears222</th>

But simillar fiddle is working even with space between string and number , so it could be an issue related to versions

Upvotes: 1

Add the following line to your code:

itemDelimiter: '</th>'

full code would be:

$(function () {
    $('#container').highcharts({
        data: {
            table: 'datatable',
            itemDelimiter:'</th>'
        },
        chart: {
            type: 'column'
        },
        title: {
            text: 'Data extracted from a HTML table in the page'
        },
        yAxis: {
            allowDecimals: false,
            title: {
                text: 'Units'
            }
        },
        tooltip: {
            formatter: function () {
                return '<b>' + this.series.name + '</b><br/>' +
                    this.point.y + ' ' + this.point.name.toLowerCase();
            }
        }
    });
});

Upvotes: 0

Related Questions