%PDF- %PDF-
| Direktori : /home/opti/workflow/src/public/app-assets/js/scripts/charts/echarts/bar-column/ |
| Current File : /home/opti/workflow/src/public/app-assets/js/scripts/charts/echarts/bar-column/basic-bar.js |
/*=========================================================================================
File Name: basic-bar.js
Description: echarts basic bar chart
----------------------------------------------------------------------------------------
Item Name: Modern Admin - Clean Bootstrap 4 Dashboard HTML Template
Version: 1.0
Author: PIXINVENT
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
// Basic bar chart
// ------------------------------
$(window).on("load", function(){
// Set paths
// ------------------------------
require.config({
paths: {
echarts: '../../../app-assets/vendors/js/charts/echarts'
}
});
// Configuration
// ------------------------------
require(
[
'echarts',
'echarts/chart/bar',
'echarts/chart/line'
],
// Charts setup
function (ec) {
// Initialize chart
// ------------------------------
var myChart = ec.init(document.getElementById('basic-bar'));
// Chart Options
// ------------------------------
chartOptions = {
// Setup grid
grid: {
x: 60,
x2: 40,
y: 45,
y2: 25
},
// Add tooltip
tooltip: {
trigger: 'axis'
},
// Add legend
legend: {
data: ['2011', '2012']
},
// Add custom colors
color: ['#666EE8', '#FF4961'],
// Horizontal axis
xAxis: [{
type: 'value',
boundaryGap: [0, 0.01]
}],
// Vertical axis
yAxis: [{
type: 'category',
data: ['Apple', 'Samsung', 'HTC', 'Nokia', 'Sony', 'LG']
}],
// Add series
series : [
{
name:'2011',
type:'bar',
data:[600, 450, 350, 268, 474, 315]
},
{
name:'2012',
type:'bar',
data:[780, 689, 468, 174, 436, 482]
}
]
};
// Apply options
// ------------------------------
myChart.setOption(chartOptions);
// Resize chart
// ------------------------------
$(function () {
// Resize chart on menu width change and window resize
$(window).on('resize', resize);
$(".menu-toggle").on('click', resize);
// Resize function
function resize() {
setTimeout(function() {
// Resize chart
myChart.resize();
}, 200);
}
});
}
);
});