Git Product home page Git Product logo

giraffe's Introduction

Giraffe

Slack Status

A React-based visualization library powering the data visualizations in the InfluxDB 2.0 UI.

giraffe

Features

There are plenty of terrific visualization libraries in the JavaScript ecosystem. Giraffe aims to distinguish itself with several features:

  • Support for the Flux language
  • Easy reactivity and extensibility via React
  • Support for mapping groupings of columns to a single visual aesthetic
  • A high-level Grammar of Graphics–style API that can specify a wide variety of visualizations with a few simple concepts
  • A columnar interface for input data that enables efficient interoperability with Web Workers and Apache Arrow
  • Self-contained configurations in the style of Vega-Lite

Demos

See the visualizations in action using Storybook.

Sample Code

See a listing of sample projects that render different types of visualizations.

Getting Started

Installation

Install Giraffe with your package manager:

yarn add @influxdata/giraffe

or

npm install @influxdata/giraffe

Example

See the Quick Start Guide for an example.

Development

To contribute to Giraffe, see the contributing guide.

Looking for details on the configuration? See the configuration guide.

giraffe's People

Contributors

121watts avatar alexpaxton avatar asalem1 avatar blegesse-git avatar chitlangesahas avatar chnn avatar david-rusnak avatar dependabot[bot] avatar dubsky avatar eatondustin1 avatar ebb-tide avatar hoorayimhelping avatar ivankudibal avatar jdstrand avatar jrenee42 avatar karel-rehor avatar kristinarobinson avatar mechivk avatar mtian725 avatar palakp41 avatar pierwill avatar rbose22 avatar reparker837 avatar sciator avatar sranka avatar tcl735 avatar timhallinflux avatar tysonkamp avatar v-rr avatar zoesteinkamp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

giraffe's Issues

Add brush/zoom interactions

  • Drag to brush, release drag to zoom into brush selection
  • Dragging horizontally brushes in x dimension
  • Dragging vertically brushes in y dimension
  • Shift+drag translates domains
  • Double click to reset zoom

zooming

Enable custom layers

Enable a user to pass a custom layer config. The config would work something like:

interface CustomLayerConfig {
  type: 'custom'
  render: (env: PlotEnv) => JSX.Element
}

The element returned by the render method should be positioned by the library like any other layer.

We should audit the PlotEnv class to make sure it provides a reasonable public interface.

It's not clear how this layer should intercept interaction events (e.g. hovering, dragging, brushing). Let's add those at a later time.

Multiple yield parsing

I am running a query with that has multiple yields in it. I am then using the fromFlux() function to parse the data.

The following is the csv response:


#group,false,false,true,true,false
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,double
#default,writes_kb,,,,
,result,table,_start,_stop,writes_kb
,,0,2019-05-31T17:54:44Z,2019-05-31T21:54:44.685122992Z,16512.4


#group,false,false,true,true,false
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,double
#default,,,,,
,result,table,_start,_stop,reads_kb
,,0,2019-05-31T17:54:44Z,2019-05-31T21:54:44.685122992Z,11111.4


#group,false,false,true,true,false
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,double
#default,writes_kb,,,,
,result,table,_start,_stop,execution_sec
,,0,2019-05-31T17:54:44Z,2019-05-31T21:54:44.685122992Z,22222.4

#group,false,false,true,true,false
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,long
#default,api_count,,,,
,result,table,_start,_stop,api_count
,,0,2019-05-31T17:54:44Z,2019-05-31T21:54:44.685122992Z,1125


The table gets parsed as
Screen Shot 2019-05-31 at 3 14 09 PM

Because each of my results are a single stat, I would expect the data for each of those columns to be an array of length 1, rather than an array of length 4.

Fix group column bug in symbols

It seems like this is using the group column computed in the stat, except that group column is based off of the fill mapping instead of the symbol mapping.

So I think if the layer was specified like:

{
  type: 'scatterplot',
  fill: ['a', 'b'],
  symbol: ['c'],
  // ...
}

Then the symbol scale would be based off of the a and b columns rather than the c column, which is what was specified.

We can totally address this in a future PR, which might have been what you were thinking. I think the solution would be to append another group column to the table—so there would be one group column based off of the fill columns, and an independent column based off of the symbol columns.

Originally posted by @chnn in https://github.com/_render_node/MDIzOlB1bGxSZXF1ZXN0UmV2aWV3VGhyZWFkMTY4MDc2NDU5OnYy/pull_request_review_threads/discussion

Support stacked position option in line layers

Similar to the position option in a histogram layer config, we should support a position option in line layer configs.

type LinePosition = 'overlaid' | 'stacked'

It should default to 'overlaid'.

The stacking logic should take place in a stat. We may have to refactor the collectLineData and simplifyLineData utils in the line layer to make this all work out.

Zero values aren't shown on line graph

Example of viz plot being used in inflxudb with problem.

viz_graph_cut_off

The zero part of the line is not visible and makes the graph look disconnected.
When I adjust the y min to be negative, the graph looks connected.

Flux Data:

#group,false,false,true,false,false
#datatype,string,long,string,long,dateTime:RFC3339
#default,_result,,,,
,result,table,_field,_value,_time
,,0,event,0,2019-05-01T12:00:00Z
,,0,event,0,2019-05-02T00:00:00Z
,,0,event,0,2019-05-02T12:00:00Z
,,0,event,0,2019-05-03T00:00:00Z
,,0,event,0,2019-05-03T12:00:00Z
,,0,event,1,2019-05-04T00:00:00Z
,,0,event,6,2019-05-04T12:00:00Z
,,0,event,0,2019-05-05T00:00:00Z
,,0,event,0,2019-05-05T12:00:00Z
,,0,event,2,2019-05-06T00:00:00Z
,,0,event,0,2019-05-06T12:00:00Z
,,0,event,10,2019-05-07T00:00:00Z
,,0,event,0,2019-05-07T06:00:00Z

Folder structure is confusing

We should create an easier folder structure, like each vis type belongs to one folder, and a simple config file for create a new type.

Reset domains after receiving a new table

  1. Render a plot
  2. Update the table in the plot config with data that has a different domain

The plot should reset its domain state, but does not currently. This is a bug in the PlotEnv memoization logic that computes the domain.

Some temporal columns in tooltip are not formatted as time

  1. Create a plot with no/default xTickFormatter and yTickFormatter options
  2. Use a temporal column as the fill grouping for a line layer

Values for the temporal column are formatted as numbers in the line tooltip. They should instead be formatter as times.

e.g. _start and _stop in the following tooltip:

Screen Shot 2019-05-02 at 2 21 19 PM

We might need to rethink the xTickFormatter and xTickFormatter options to handle this properly—what about other values that require custom formatting in tooltips? For example, large numbers or numbers with units. Perhaps the xTickFormatter and yTickFormatter should instead be numberFormatter and timeFormatter options.

Add stress tests

We should have some way of stress testing plots (large and/or high cardinality data sets).

Decompose histogram / heatmap layers into stats + a continuous bar layer

We should add a new layer type that enables plotting rectangles with arbitrary x start / x stop / y start / y stop positions (along a continuous axis). The histogram and heatmap layer types should then use this layer type internally. For more motivation on the approach, see Section 6.1 of https://vita.had.co.nz/papers/layered-grammar.pdf

This would enable a user to plot histograms and heatmaps using precomputed data (e.g. via Flux).

This may be a good time to expose more powerful capabilities in the public API:

  • The ability to specify a transform / stat with each layer (e.g. "bin my data" or "compute a regression line")
  • The ability to specify the scale corresponding to a data-to-aesthetic mapping. To use the language of Vega (see [1], [2], [3]), a user should be able to specify that a scale is nominal/ordinal (to make a histogram using the bar layer) or quantitative (to make a heatmap using the bar layer)

Show individual points in line graphs when possible

Right now, we show the individual points on a line graph when during a hover:

points

We should add an option to line graphs to show all points that make up a line, not just the currently hovered points, whenever there is space.

This will help users who end up plotting lines with only a single point, as well as users who want to see their actual data set as part of an interpolated line.

  • Points should only show when for every line in the line layer, each point in the line is at least 2 * pointRadius away from all other points in the line

  • Update the points to have a "hollowed out appearance":

    Screen Shot 2019-05-16 at 10 38 09 AM

    The hovered state of the point should put a dot in the center of the point.

Add a `sort` and `aggregate` option to line layers

A line layer should have sort and aggregate options.

If there are multiple y values for a particular x value, the aggregate option defines how to plot those y values as a single point. It should support common aggregate operations like mean, median, mode, max, min, etc.

sort defines the ordering of points within a group in the table (which controls the ordering of line segments in the plot).

Makes heatmaps "clickable"

Hello!
I would like to have every single square clickable. The use case I have in my mind is to jump to a different visualization of the particular event from the heatmap.

Let's say that I am visualizing the HTTP request latency and every square represent a request, I would like to be able to go to my trace, or to the dashboard that visualizes a single request clicking the square.

In Chronograf we can have a convention: "if the point returns a _link field it is the target of the square" in this way we can use a query to compose and inject the _link to the graph.

Add a Flux CSV to vis table adapter

  • Identify columns uniquely by (type, name) tuples
  • Add a name property to table columns
  • Retain and return information about the Flux group key
  • Retain and return information about how many Flux tables a column appears in

Line layer crashes when hovering over edge in Firefox

bug

Only occurs in Firefox (tested in latest Safari, Firefox, Chrome on macOS). Storybook reproduction is the "edge hover bug" story on the hover-index-bug branch.

TypeError: closestRowIndices is undefined
    lookupIndex2D useHoverLineIndices.ts:261
    useHoverLineIndices useHoverLineIndices.ts:54
    LineLayer LineLayer.tsx:76
    React 16
    dispatchEvent (index):1018

The issue is that the hover index doesn't have a bin for the y value at the very bottom of the plot (the max y value).

Can't control tick generation

It's desirable to format ticks using a binary unit prefix when plotting data whose y-value is measured in bytes.

But the y-axis generates tick marks at "nice" intervals, i.e. at powers of 10. These intervals are no longer nice when formatting numbers with a binary unit prefix.

For example, here's the same plot with ticks formatted using a decimal unit prefix:

Screen Shot 2019-06-04 at 2 58 24 PM

It has a nice tick of "6G". When formatting the ticks with a binary unit prefix, it looks like this:

Screen Shot 2019-06-04 at 2 58 31 PM

The generated tick is now "5.5879G" (6 gigabytes =~ 5.88 gibibytes), which is no longer nice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.