#22 Basic Pie Chart

This commit is contained in:
Ashish Jain
2019-09-11 21:20:28 +02:00
parent 78cae3dce7
commit 42fc23cff2
42 changed files with 2571 additions and 3602 deletions

50
src/diagrams/pie/pieDb.js Normal file
View File

@@ -0,0 +1,50 @@
/**
*
*/
import { logger } from '../../logger'
let sections = {}
let title = ''
const addSection = function (id, value) {
if (typeof sections[id] === 'undefined') {
sections[id] = value
logger.debug('Added new section :', id)
// console.log('Added new section:', id, value)
}
}
const getSections = () => sections
const setTitle = function (txt) {
title = txt
}
const getTitle = function () {
return title
}
const cleanupValue = function (value) {
if (value.substring(0, 1) === ':') {
value = value.substring(1).trim()
return Number(value.trim())
} else {
return Number(value.trim())
}
}
const clear = function () {
sections = {}
title = ''
}
// export const parseError = (err, hash) => {
// global.mermaidAPI.parseError(err, hash)
// }
export default {
addSection,
getSections,
cleanupValue,
clear,
setTitle,
getTitle
// parseError
}