提交 d267c520 编写于 作者: View Design's avatar View Design

Merge branch 'main' of gitcode.com:git_bot/ai-fe

......@@ -191,12 +191,24 @@ function handleFormatWebSource (source) {
return sources
}
function handleFormatReports (content) {
let start = '::ProseLineChart'
let chartStart = '::ProseLineChart'
// todo
let tableStart = '::ProseDataTable'
let result = ''
// ::ProseLineChart{title='xxx' :labels='[]' :data='[]'}
content.forEach(item => {
const { title, data, columns } = item
let toStr = JSON.stringify({ title, data, columns })
result += `${start}{:data=${toStr}}`
const { title, data, format } = item
if (format === 'timeline') {
const labels = []
const datas = []
data.forEach(child => {
labels.push(child.date)
datas.push(child.stargazers)
})
result += `${chartStart}{title=${title} :labels=${JSON.stringify(labels)} :data=${JSON.stringify(datas)}}`
} else if ( format === 'table' ) {
result += `${tableStart}{:data=${JSON.stringify(data)}}`
}
})
return result
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册