GithubHelp home page GithubHelp logo

plotly / react-chart-editor Goto Github PK

View Code? Open in Web Editor NEW
502.0 41.0 102.0 26.94 MB

Customizable React-based editor panel for Plotly charts

Home Page: https://plotly.github.io/react-chart-editor/

License: MIT License

JavaScript 89.39% CSS 0.04% HTML 0.05% SCSS 10.52%

react-chart-editor's Issues

Fill color - Default and custom

Plotly to provide their color picker as a default; built in a way that it can be updated later.

This feature requires the color picker to work, which is mainly dependent upon #9.

Canvas size: display in inches

Similar to photoshop, it would be nice to have a linked editor in which you can specify inches and get pixels. That requires some conversion factor like 72 dpi that's just not as relevant in 2017 as it used to be, but so that we can provide intuitive units for people to work with and since it affects things like font sizes, the photoshop editor is probably a good way to approach it.

screen shot 2017-10-16 at 10 41 35

<TraceSelector> should compute all Plotly.js traces

Right now <DefaultEditor> computes all the Plotly.js traces and passes those down to <TraceSelector>

Now that we are standardizing on the idea of one-stop shop components that handle all their own craziness we should move the traceOptions handling from DefaultEditor to TraceSelector.

Hide sections with no valid properties

The presence or lack of an attribute value in fullData is enough to hide or show the corresponding field automatically. Visibility of the section headings isn't free. It might be necessary to traverse the config and hide/show them accordingly, depending on whether any specific fields are present or not.

screen shot 2017-10-13 at 15 14 32

Minimize unnecessary plotprops computation

When application logic changes unpackPlotProps is run on every rendered attribute Field. Investigate a way to prevent this from happening. Probably worth starting with the Editor revision number ++

Transpile *all* src files

Only transpiling the entry point breaks everything. For an exported component, all source files must be transpiled into lib.

Remove `bem` function

We now have nested CSS so the bem function isn't as useful. It also requires a number of extra function calls when it's fairly trivial to hardcode strings. Hardcoded strings are easier to search the src code for as well. Searching for CSS strings in src code happens fairly often when debugging an application.

Bar & Pie charts

Add selector for bar and pie chart types. The menu is not yet graphical, and not yet addressed is the way that the workspace has a fairly loose mapping between chart types displayed in the selector and internal trace types. That is, there is no "area" chart, but the workspace shows an "area" chart type for convenience.

Add SCSS build process

So far I've been sticking with plain CSS. It's the main barrier preventing the color selector from working, so it seems that the time has come to pull in scss from streambed and get a proper scss pipeline hooked up.

Scope all css selectors

I've been taking a sort of extended BEM approach to the CSS selectors. That is, BEM but prefixed with plotly-editor. The reason is so that you can include the editor on any page and expect it not to conflict with your existing CSS. With SCSS/LESS, the prefix could be centralized into one location, but at the moment this seems adequate.

TO DO: I took a few shortcuts just leaving streambed component class names as-is. They should also be prefixed.

Title and Fonts: Typeface

Text editor to change title content and font.

Depends upon: font selector menu, possibly rich text editor from streambed.

Section visibility nuances

see #54 (comment)

Right now <Section> will hide itself when all of its attr children are not visible. Currently if you put non attr children in a <Section> it will show. However you could make the case that <Info> (for example) should not by default force <Section> to show since it is <Info> about non applicable (and hidden) fields.

We might be able to extend this argument to <MenuPanel> (CogMenu) as well. If CogMenu is always (or almost always) an advanced settings of the base fields in <Section> then it may not make sense to show it.

To resolve this we need to look at all the CogMenus in the workspace and figure out sane defaults.

i18n

Opening this for a discussion of i18n, both for this and for the public plotly.js repo.

There are a few different ways to accomplish this. In semi-pseudocode, the i18n function fundamentally looks like:

function _( key ) {
  if (key in dictionary) {
    return dictionary[key]
  } else {
    return key
  }
}

The input is the string itself, which has pros and cons. The dictionary looks like:

{
  "es": {
    "Trace": "Rastro",
    "Click to toggle visibility": "Haga clic para activar la visibilidad",
    ...etc
  },
  "ru": {
    ...
  }
}

You'd use this like:

_("Trace")

The downside is that "Trace" (nominative) and "Trace" (accusative) have different translations in some languages. If this were the case, you could be more explicit and make nontrivial use of an english dictionary to use keys instead of the strings themselves.

{
  "en": {
    "Trace label in style panel": "Trace"
  },
  "es": {
    "Trace label in style panel": "Rastro",
    "Click to toggle visibility": "Haga clic para activar la visibilidad",
    ...etc
  },
  "ru": {
    ...
  }
}
_("Trace label in the style panel")

Or maybe panels.style.trace or whatever you prefer. It's a bit free-form.

At any rate, you'd pass in a dictionary which would get deep-merged into whatever default dictionaries plotly.js has built in. The fallback is builtin dictionary values or just a pass-through i18n function.

For plotly, the dictionary would be passed through config as, e.g. {"es": {...}} and the desired language would be specified as, e.g "language": "es". As in:

Plotly.plot(gd, {
  data: {...},
  config: {
    language: "es",
    dictionary: {
      es: {
        key: value
      }
    }
  }
})

(locale instead of language? dictionaries, plural? I at least like the idea of being able to pass multiple dictionaries in one parameter so that changing the language would be possible.)

For plotly.js it could also be possible to use Plotly.Register. As in:

Plotly.Register(require('plotly.js/dictionaries/en.json'))
Plotly.Register(require('plotly.js/dictionaries/es.json'))

Plotly.plot(gd, {config: {language: 'es'}})

For react components, the editor would probably receive a dictionary and expose it through context. All components would inherit from a base component that makes the dictionary available so that it's not global and so that the dictionary doesn't need to trickle down through props explicitly. Then instead of importing _, you'd inherit from the base component and have this._(...) automatically available.

/cc @bpostlethwaite @alexcjohnson @etpinard

Reference Issues

It looks like the latest commit added a lib folder to the lib folder which threw off all the references to common in the components. Also, the PlotlyReactEditor.js file changed from plotly.js-react-editor which broke the reference in index.js

But after fixing all those references, I get the following run-time error:
TypeError: Super expression must either be null or a function, not undefined index.js:35134:113

Select Controls are Broken

After the most recent updates, the select controls for selecting trace x, y, and plot type no longer function. clicking and holding one shows the options, but they disappear when you release the mouse so you can't select one. I tried to see if the same behavior happens in the react-lab example, but it no longer compiles because of new referencing issues.

npm start fails

Error: Cannot find module '../../src/plotly.js-react-editor.jsx' from '/home/ben/plotly/react-plotly.js-editor/example/src'

Title and fonts: Size

Font size menu. (To check: Is this a regular select menu? Part of the rich text editor? Both?)

nest icon classes

Split the actual icon class definitions into their own file that can be nested in the main.scss and remove their plotlyjs_editor prefixes.

I think @fontface still needs to be global scope so that will need to be included in a fonts. Does it need to be global? It didn't work when I tried nesting the whole of _icons.scss but I didn't do much investigation.

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.