DataVisual

package module
v0.0.0-...-f8da358 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2019 License: MIT Imports: 12 Imported by: 3

README

Discontinued working on this. SVGo solved all of my problems and looks much nicer than this project which was, admittedly, more about playing around in Go than solving a problem. Leaving this up in case others want to play with it or want to send me hints about better Go style.

DataVisual

X11 based Go library for creating basic plots, graphs, and general data visualization.

The goals of this library is to create 'quick and dirty' plots for 'what does my data look like?' moments.

Easy of use is emphasized over performance or optional capabilities.

Think of this as you would fmt.Print() when doing fast value checks while developing, only for graphs and plots.

The current plan is to use reflection to allow for a single Plot() function which just takes the data and displays it in the most reasonable default manner. Eventually there will be a system for adding new plot stylings, default overrides, and features like zooming, saving of plots, and overlays/multiplots.

Ease of use will always take preference over extensibility.

Current Status

Done:

  1. PlotWindows can be created and removed asynchronously.
  2. PlotWindows can be waited on.
  3. Hook in for displaying plots.

TODO:

  1. Static point plotting. "Here are some points. Plot them."
  2. Static complex point plotting. "Here are some complex numbers. Plot them."
  3. Static time series plotting. "Here is some points on a time line. Plot them."
  4. Dynamic plotting of the above. "Here is a channel. Listen to it and plot the stuff I give you, updating the plot as it comes in."

Documentation

Overview

package DataVisual provides default plotting windows and functions for go. Uses a X11 binding in order to provide window handling which limits to X11 compatible systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAllPlots

func CloseAllPlots()

func WaitForAllPlotsClosed

func WaitForAllPlotsClosed()

Types

type DVSystem

type DVSystem struct {
	X *xgbutil.XUtil
	// contains filtered or unexported fields
}

func Initialize

func Initialize() (*DVSystem, error)

DVSystem uses the (scary!) package global singleton system variable. Normally we won't be creating a DVSystem since we want to just single line create static or dynamic plots. But incase someone needs to fiddle with the internal DataVisual X11 binding components this will allow them to create as they need it instead of whenever the first plot is created.

type PlotWindow

type PlotWindow struct {
	// contains filtered or unexported fields
}

func NewPlotWindow

func NewPlotWindow(width, height int, title string) (*PlotWindow, error)

Creates and displays a new plot window. Defaults to an all white background with the upper left corner at (0,0). If title is "" then the title will be an auto incrementing "Figure - #"

func (*PlotWindow) Close

func (plot *PlotWindow) Close()

Tells the DVSystem to remove this plot (which closes it) and lets it handle the cases of waiting for all plots to close and sending the per plot close message and the all plot closed message.

func (*PlotWindow) DrawPoint

func (plot *PlotWindow) DrawPoint(x, y int, pixelColor color.Color)

Draws a single point on the window in the window (rather then plot) coordinate system. This routine is slow because it is essentially performing a buffer flip for each point.

This routine should be avoided. This is here as an assistance function rather then the intended routine to be used for plotting. Prefer the 'Plot' data functions over this function in almost all circumstances.

func (*PlotWindow) DrawPoints

func (plot *PlotWindow) DrawPoints(points []image.Point, pixelColor color.Color)

Draws a array of points on the window in the window (rather then plot) coordinate system. This routine is faster then the single point system because it performs only one buffer flip per Point array rather then per point.

This routine should be avoided. This is here as an assistance function rather then the intended routine to be used for plotting. Prefer the 'Plot' data functions over this function in almost all circumstances.

func (*PlotWindow) SetTitle

func (plot *PlotWindow) SetTitle(Title string)

Set the window title.

func (*PlotWindow) WaitForClosed

func (plot *PlotWindow) WaitForClosed()

If the window exists it waits on the closed channel until it receives anything. This is simply a wait/signal system but it should be true simply for the sake of consistancy.

func (*PlotWindow) WindowHeight

func (plot *PlotWindow) WindowHeight() int

The height of the plot window. This is the height of the UI Window.

func (*PlotWindow) WindowWidth

func (plot *PlotWindow) WindowWidth() int

The width of the plot window. This is the width of the UI Window.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL