You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.4 KiB

/*=========================================================================================
File Name: project-summary-task.js
Description: Project Summary Page JS
----------------------------------------------------------------------------------------
Item Name: Modern Admin - Clean Bootstrap 4 Dashboard HTML Template
Version: 1.0
Author: PIXINVENT
Author URL: http://www.themeforest.net/user/pixinvent
==========================================================================================*/
// Basic pie chart
// ------------------------------
$(window).on("load", function(){
// Set paths
// ------------------------------
require.config({
paths: {
echarts: '../../../app-assets/vendors/js/charts/echarts'
}
});
// Configuration
// ------------------------------
require(
[
'echarts',
'echarts/chart/pie',
'echarts/chart/funnel'
],
// Charts setup
function (ec) {
// Initialize chart
// ------------------------------
var myChart = ec.init(document.getElementById('task-pie-chart'));
// Chart Options
// ------------------------------
chartOptions = {
// Add title
/*title: {
text: 'Task progress',
subtext: 'Open vs Closed Task',
x: 'center'
},*/
// Add tooltip
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
// Add legend
legend: {
orient: 'horizontal',
x: 'left',
data: ['Open', 'Closed']
},
// Add custom colors
color: ['#FECEA8', '#FF847C'],
// Display toolbox
toolbox: {
show: true,
orient: 'horizontal',
//Enable if you need
/*feature: {
magicType: {
show: true,
title: {
pie: 'Switch to pies',
funnel: 'Switch to funnel',
},
type: ['pie', 'funnel'],
option: {
funnel: {
x: '25%',
y: '20%',
width: '50%',
height: '70%',
funnelAlign: 'left',
max: 1548
}
}
},
restore: {
show: true,
title: 'Restore'
},
saveAsImage: {
show: true,
title: 'Same as image',
lang: ['Save']
}
}*/
},
// Enable drag recalculate
calculable: true,
// Add series
series: [{
name: 'Browsers',
type: 'pie',
radius: '70%',
center: ['50%', '57.5%'],
data: [
{value: 18, name: 'Open'},
{value: 82, name: 'Closed'}
]
}]
};
// 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);
}
});
}
);
});