Highcharts Demo

author(s): Torstein Hønsi

by AbhishekRohan

HTML

<script src="https://code.highcharts.com/js/highcharts.js"></script>
<script src="https://code.highcharts.com/js/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/pattern-fill.js"></script>
<div id="container"></div>

CSS

@import 'https://code.highcharts.com/css/highcharts.css';

#container {
	height: 400px;
	max-width: 800px;
	min-width: 320px;
	margin: 0 auto;
}

.highcharts-legend .highcharts-point {
    stroke-width: 10;
}


/* Pattern presentational properties */
#hatch-left path {
  stroke: #AB1C1C;
  stroke-width: 10px;
}


.highcharts-series-0 .highcharts-area, .highcharts-legend .highcharts-series-0 .highcharts-point {
  fill: url(#grid);
}
.highcharts-series-1 .highcharts-point {
  
  fill: url(#hatch-left);
}

JavaScript

// Define the patterns
Highcharts.setOptions({
    defs: {
        hatchLeft: {
            tagName: 'pattern',
            id: 'hatch-left',
            patternUnits: 'userSpaceOnUse',
            backgroundColor:"red",
            width: 5,
            height: 10,
            radius:5,
            children: [{
                tagName: 'path',
                d: 'M 1.5 0 L 1.5 4 M 0 1.5 '
            }]
        },
    
    }
});

Highcharts.chart('container', {

    title: {
        text: 'Patterns in styled mode'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [1, 4, 3, 5, 6],
        type: 'area',
        visible: false
    }, {
        data: [
        {color:"red",
            y:2},
        4,
        1,
        4,
        4],
        type: 'column'
    }]
});