Comments (4)
I second this, I'd absolutely love to be able to use X axis too.
from asciigraph.
@guptarohit @medzernik Any updates on this issue? I need to have time values in the X-Axis.
It's been a long while, but I remember going with my own date input. This is the code I used to sort of make it work with dates. I used this output in Discord and made sure the dates fit on various iOS devices as well as on the desktop:
package covid_slovakia
import (
"github.com/guptarohit/asciigraph"
)
// PrintLineASCII Prints the actual chart, gets the data as well as the labelstring to put in.
func PrintLineASCII(data []float64, dateStringStart, dateStringEnd string) string {
graphLabel := NormalizeXAxis(dateStringStart, dateStringEnd)
var chart string
// The length 22 is the magical number for correct formatting on iPhones (tested on iPhone 11 Pro and iPhone SE 2020)
// that's why we wrap it around when it's bigger than that. Height is 15
chart = asciigraph.Plot(data, asciigraph.Width(22), asciigraph.Height(15), asciigraph.Caption(graphLabel))
return chart
}
// NormalizeXAxis Inserts the X axis-like line at least, since there is no X axis...
func NormalizeXAxis(startDate, endDate string) string {
return "―――――――――――――――――――――\n\t" + startDate + " <-> " + endDate
}
// GetGraphReadyForDiscordPrint Simplifies the printout for reuse
func GetGraphReadyForDiscordPrint(input string) string {
return "**\n```go\n" + input + "```"
}
from asciigraph.
@guptarohit @medzernik Any updates on this issue? I need to have time values in the X-Axis.
It's been a long while, but I remember going with my own date input. This is the code I used to sort of make it work with dates. I used this output in Discord and made sure the dates fit on various iOS devices as well as on the desktop:
package covid_slovakia import ( "github.com/guptarohit/asciigraph" ) // PrintLineASCII Prints the actual chart, gets the data as well as the labelstring to put in. func PrintLineASCII(data []float64, dateStringStart, dateStringEnd string) string { graphLabel := NormalizeXAxis(dateStringStart, dateStringEnd) var chart string // The length 22 is the magical number for correct formatting on iPhones (tested on iPhone 11 Pro and iPhone SE 2020) // that's why we wrap it around when it's bigger than that. Height is 15 chart = asciigraph.Plot(data, asciigraph.Width(22), asciigraph.Height(15), asciigraph.Caption(graphLabel)) return chart } // NormalizeXAxis Inserts the X axis-like line at least, since there is no X axis... func NormalizeXAxis(startDate, endDate string) string { return "―――――――――――――――――――――\n\t" + startDate + " <-> " + endDate } // GetGraphReadyForDiscordPrint Simplifies the printout for reuse func GetGraphReadyForDiscordPrint(input string) string { return "**\n```go\n" + input + "```" }
Thanks for the help @medzernik , I need to try this out, I am building a CLI app to plot my laptop's battery usage in the terminal. I am trying to visualize my battery level and cycle count with the help of the graph. https://github.com/neymarsabin/batterarch
I will try this implementation, but may write my own graph library if I need some other graphs.
from asciigraph.
@guptarohit @medzernik Any updates on this issue? I need to have time values in the X-Axis.
from asciigraph.
Related Issues (20)
- Axis cross (┼) is in the wrong place at some scales HOT 2
- [Idea] add an option to set the step of series HOT 2
- Hello! Thank you. :)
- Panic when no positive values provided HOT 3
- Reformat Code HOT 5
- Can I plot bar graphs? HOT 1
- NaN numbers HOT 1
- caption not centred HOT 1
- Add option to set fixed range for values
- Confused about the Offset option HOT 2
- Two options: ColorAbove and ColorBelow HOT 1
- Add reference to https://github.com/kroitor/asciichart HOT 1
- PlotMany from command line HOT 2
- Add tests for CLI HOT 2
- CLI: for realtime data stream, clear old graph before plotting new data
- How to install now that `go get` is deprecated HOT 1
- Add legend to graph HOT 1
- is it possible to generate a svg or jpg image? HOT 1
- Panics if data is flat HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciigraph.