%PDF- %PDF-
| Direktori : /home/opti/workflow/src/public/app-assets/js/scripts/charts/echarts/line-area/ |
| Current File : /home/opti/workflow/src/public/app-assets/js/scripts/charts/echarts/line-area/stacked-area.js |
/*=========================================================================================
File Name: stacked-area.js
Description: echarts stacked area chart
----------------------------------------------------------------------------------------
Item Name: Modern Admin - Clean Bootstrap 4 Dashboard HTML Template
Version: 1.0
Author: PIXINVENT
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
// Stacked area 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('stacked-area'));
// Chart Options
// ------------------------------
chartOptions = {
// Setup grid
grid: {
x: 40,
x2: 20,
y: 35,
y2: 25
},
// Add tooltip
tooltip: {
trigger: 'axis'
},
// Add legend
legend: {
data: ['Email marketing', 'Advertising alliance', 'Video ads', 'Direct access', 'Search engine']
},
// Add custom colors
color: ['#F98E76', '#28D094', '#1E9FF2', '#FF4961', '#626E82'],
// Enable drag recalculate
calculable: true,
// Add horizontal axis
xAxis: [{
type: 'category',
boundaryGap: false,
data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
}],
// Add vertical axis
yAxis: [{
type: 'value'
}],
// Add series
series: [
{
name: 'Email marketing',
type: 'line',
stack: 'Total',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: 'Advertising alliance',
type: 'line',
stack: 'Total',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: 'Video ads',
type: 'line',
stack: 'Total',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: 'Direct access',
type: 'line',
stack: 'Total',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: 'Search engine',
type: 'line',
stack: 'Total',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 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);
}
});
}
);
});