Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the font family of Highchart to Bootstrap css default font family

I want to change the font of title, data label and tooltip to Bootstrap default default font in the pie chart (I'm using Highchart library to show the chart). I'm How can I change these? Tried to add fontFamily but it didn't work.

var chart = new Highcharts.Chart({
                    chart: {
                        renderTo: $(element).attr('id'),
                        backgroundColor: '#F8F8F8'
                    },
                    title: {
                        text: "Space Used by Users",
                        fontFamily: 'Helvetica'
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true,
                                format: '{point.name}: {point.sizeText}',
                                style: {
                                    fontSize: '11px'
                                }
                            },
                            showInLegend: true
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.sizeText}</b>'
                    },
                    series: [{
                        type: 'pie',
                        data: [
                            {
                                name: 'Personal Usage',
                                y: scope.item.personalUsage,
                                sizeText: scope.item.personalUsageSizeText
                            },
                            {
                                name: 'Shared Usage',
                                y: scope.item.sharedUsage,
                                sizeText: scope.item.sharedUsageSizeText
                            }
                        ]
                    }]
                });

How to change the font to default bootstrap?

like image 464
fatCop Avatar asked May 05 '15 10:05

fatCop


People also ask

How do I change my font-family in Highchart?

You can change it in options. chart. style. fontFamily.

What is bootstrap default font-family?

Bootstrap 4 Default Settings The default font-family is "Helvetica Neue", Helvetica, Arial, sans-serif. In addition, all <p> elements have margin-top: 0 and margin-bottom: 1rem (16px by default).

How do I import a font-family into bootstrap?

Importing Your Web Font After you extract the zip file you generated above (or if you already have a webfont), right click the Fonts group in Bootstrap Studio and choose Import Webfont . In the file browser, navigate to the webfont and select the css file in the folder.


1 Answers

You are only setting the font for the chart title. The below code sets the font globally for the pie chart.

    Highcharts.setOptions({
    chart: {
        style: {
            fontFamily: 'Helvetica'
        }
    }
   });
like image 145
majorhavoc Avatar answered Sep 28 '22 10:09

majorhavoc