-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add value labels * fix: upgrade styl3 * fix: readme * feat: final touches for valueLabels * chore: upgrading styl3 * fix: snapshots * docs: updated readme for valueLabels * fix: refactors
- Loading branch information
Showing
17 changed files
with
951 additions
and
748 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const shellfie = require('shellfie'); | ||
const Chartscii = require('../dist'); | ||
|
||
let color = ''; | ||
|
||
const colors = [ | ||
'red', | ||
'green', | ||
'yellow', | ||
'blue', | ||
'purple', | ||
'pink', | ||
'cyan', | ||
'orange', | ||
'white', | ||
'marine' | ||
]; | ||
|
||
// generate random chart data | ||
// const data = []; | ||
const labels = ['c', 'h', 'a', 'r', 't', 's', 'c', 'i', 'i', '3.0']; | ||
// for (let i = 0; i < 3; i++) { | ||
// const color = colors[i]; | ||
// const value = Math.floor(Math.random() * 20); | ||
// data.push({ value, color, label: `loading` }); | ||
// } | ||
|
||
const data = [ | ||
{ label: "label", value: 1, color: "pink" }, | ||
{ label: "label", value: 2, color: "purple" }, | ||
{ label: "label", value: 1.5, color: "marine" }, | ||
{ label: "label", value: 3, color: "red" }, | ||
{ label: "label", value: 2.5, color: "blue" } | ||
]; | ||
const chart = new Chartscii(data, { | ||
// height: 10 | ||
// width: 50 | ||
// width: 50, | ||
// // padding: 2, | ||
// barSize: 1, | ||
padding: 1, | ||
barSize: 1, | ||
valueLabels: true | ||
// naked: true, | ||
// valueLabels: true, | ||
// fill: '░', | ||
// colorLabels: true, | ||
// theme: 'pastel', | ||
// orientation: 'vertical' | ||
}); | ||
|
||
|
||
(async () => { | ||
try { | ||
const data = chart.create(); | ||
console.log(data); | ||
await shellfie(data, { | ||
name: './chartscii_chartpoint', | ||
viewport: { | ||
width: 1024, | ||
height: 300 | ||
}, | ||
}); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
})(); | ||
|
||
|
||
// termtosvg --still-frames --command 'npx ts-node test.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Chartscii from '../chartscii'; | ||
|
||
|
||
|
||
// const data = [ | ||
// // { value: 18.32, label: '2007' }, | ||
// // { value: 23.23, label: '2008' }, | ||
// // { value: 2.43, label: '2009' }, | ||
// // { value: 5.21, label: '2010' }, | ||
// // { value: 50.97, label: '2011' }, | ||
// // { value: 21.05, label: '2012' }, | ||
// // { value: 1.01, label: '2014' }, | ||
// { value: 183.32, label: '2007' }, | ||
// { value: 231.23, label: '2008' }, | ||
// { value: 26.43, label: '2009' }, | ||
// { value: 50.21, label: '2010' }, | ||
// { value: 508.97, label: '2011' }, | ||
// { value: 212.05, label: '2012' }, | ||
// { value: 10.01, label: '2014' }, | ||
// ] | ||
const data = [ | ||
{ label: "label", value: 1, color: "pink" }, | ||
{ label: "label", value: 2, color: "purple" }, | ||
{ label: "label", value: 1.5, color: "marine" } | ||
]; | ||
|
||
const chart = new Chartscii(data, { | ||
// width: 50, | ||
// // padding: 2, | ||
// barSize: 1, | ||
// naked: true, | ||
// valueLabels: true, | ||
// fill: '░', | ||
// colorLabels: true, | ||
// theme: 'pastel', | ||
// orientation: 'vertical', | ||
}); | ||
|
||
console.log(chart.create()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.