Giter VIP home page Giter VIP logo

orama's People

Contributors

billyjanitsch avatar jhhayashi avatar nabeel- 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

orama's Issues

Test using public API where possible

Currently, our unit tests live adjacent to the files they test. This makes sense for testing pieces in isolation, but we never verify whether we are exposing a given piece as part of the public API. During cleanup, it's important that we don't unintentionally remove parts of the public API outside of a major release, so I'd like to establish these guarantees.

We can do this by having tests import from the top-level public API where possible. These tests could be moved to a top-level test/ directory, with the Mocha config updated accordingly, which is more consistent with how we tests other projects internally. (Any files which test orama internals -- not exposed at the top-level -- could stay where they are, for now.)

Investigate double/triple canvas render

This code is surprising:

componentDidUpdate() {
this.handleUpdate(this.props)
}
componentWillReceiveProps(nextProps) {
if (this.props.renderData !== nextProps.renderData) {
this.handleUpdate(nextProps)
}
if (this.props.renderLayers !== nextProps.renderLayers) {
this.handleUpdate(nextProps)
}
}

It's possible for up to 3 canvas re-renders to be triggered on a single update. Maybe there's a complicated reason why this is necessary (fit-checking text?), or maybe it was unintentional.

The easiest way to figure this out is probably to profile the re-renders in one of our existing internal uses of orama, and/or see what happens to our internal usage if we remove the cWRP lines.

Remove window utils

orama implements a simple window mock for node environments. It's only used in one place internally which should be easy to substitute. However, it's exported at the top-level because of a re-export in utils/, so its removal will be a breaking change.

export * as windowUtils from './windowUtils'

Flatten directory structure

Currently, all files are named index.js and live in an appropriately-named folder. This was a stylistic choice when orama was first written, but I'd like to align it with the style used internally and more commonly used elsewhere.

Drop support for React 15

We might also want to drop support for React <16.3, so that we can use the new lifecycle methods.

Re-enable remaining lint rules

  • no-nested-ternary
  • no-param-reassign
  • no-shadow
  • no-underscore-dangle
  • react/forbid-prop-types
  • react/no-access-state-in-setstate
  • react/no-deprecated
  • react/no-unused-prop-types
  • react/no-unused-state
  • react/sort-comp

Unintentional breaking change in custom tooltip API

When writing #143, I forgot that orama allows consumers to pass a custom tooltip component, so the changes I made to the API of the default tooltip component should not have been backwards-incompatible. This caused an unintentionally breaking change in 2.0.1.

We can keep most of that refactor, but we need to revert the component API, which will require the measuring code to be pulled back out into another component.

Brush crashes when mouse leaves and re-enters bounds

To reproduce, in the Brush sandbox example:

  1. Click and hold the brush
  2. Move the mouse outside of the brush bounds
  3. Move it back inside the bounds

Here's the stack trace:

Uncaught TypeError: Cannot read property 'x' of null
    at mouseDrag (Brush.js:108)
    at handleChart (Brush.js:169)
    at Object.onUpdate (Brush.js:198)
    at handleCanvasInput (index.js:34)
    at Object.onUpdate (index.js:68)
    at CanvasInput.<anonymous> (index.js:126)

Might have been introduced in 9c50642. @nabeel-, would you mind investigating?

Add stress tests to sandbox

To make sure we don't regress in performance for very large data sets. (The current sandbox examples all use small ones.)

Scale charts based on pixel density

Currently, we scale all canvases by 2x, which makes them look sharp on displays with a pixel density of exactly 2. But we don't need to incur this performance cost on low-density displays, and we should scale more on displays with an even greater density.

Here's a good example of how to do this, and here's some info on pixel density and backing stores.

Tooltip offset from position

I've encountered a problem but I'm still trying to reproduce it outside my app.
My chart is inside several containers with fixed > absolute positions.
It's tooltip is being offset by the chart's relative parent 'left' position.
I tried studying the TooltipWrapper component but couldn't figure the problem that easily.
I'll continue trying to reproduce the problem in codesandbox.io and place the link here when I'm done.

Remove use of function constructor

Generally it's not good practice to call the Function constructor. Like eval, it's a fragile operation with many associated security vulnerabilities, and there is usually a better solution.

const func = new Function(...keys(datum), `return ${funcString}`)

We should figure out why we're calling the constructor here, and come up with a better solution.

Fix area plotting

I think I broke areas at some point during the refactor. Looking at the sandbox, the first point in each area is missing.

We probably need to cherry-pick the sandbox onto an old version, rebase everything else on top of that, then bisect.

Remove image renderer

The image renderer is fairly large and isn't used within orama -- it's only exported as a utility. It seems out of scope for the library, and we don't use it internally, so I think we should remove it in v2.

Enable onEvent bindings?

I wish I would be able to take an action when the user hovers or clicks a data point.
However I did not found anything in the docs on how to do this. Is this available?
Is there any design issues on enabling this?

My use case is this:
I have an area chart that I wish I would display additional information when the user hovers a data point. I understand there is the tooltip component but the information would be better displayed in a larger and fixed container. (The container will display the details of the last hovered/clicked even when the user leaves the chart.)

And congratulations again on this library Luis. I was using chart.js since I had no available time to study d3.js properly. But I quickly found myself trying to compose different chart types and with this library this is a complete breeze. Thanks!

Compute data hover using voronoi diagram

Profiling the stress test in #123, I noticed that 40% of each frame is spent calling isPointInStroke to compute which datum the mouse is hovering over. (This use of isPointInStroke is also the only reason that orama requires a polyfill to support IE 11, AFAIK.)

screen shot 2018-06-06 at 7 44 58 pm

Instead of this canvas-based approach, we could collapse all data into a voronoi diagram, and use it to determine the closest datum to a given mouse position, which would be relatively instantaneous. Here's an example of that approach.

(This would change the existing hover behavior, arguably for the better.)

Add linter

Probably converging orama's style with Kensho is too much work to be worthwhile, but we could see how far we'd get by adding our standard ESLint config, running an autofix, and disabling outstanding failing rules.

This would at least run the codebase through Prettier, and might catch some bugs.

Clean up file naming and exports

Most files should either contain a single default export or several named exports. Files in the former category should be named according to their export, and those in the latter category should be given a plural name that describes the collection of their exports (e.g. "utils").

The only case where a file should have both a default and named exports is when the default export is the sole export consumed elsewhere, and the named exports are exported for testing purposes.

Currently, orama uses a mix of conventions, so it would be nice to clean this up.

Incorrect offset behavior when re-entering brush

If you click and hold a brush range, leave the brush bounds, and re-enter the bounds somewhere else, the brush does not snap to the new location, but instead offsets from the old one.

Compare 2.0.0-alpha.1:

v2

To 1.5.1:

current

We should ensure the old behavior is preserved.

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.