Giter VIP home page Giter VIP logo

fews-web-oc-charts's People

Contributors

wkramer avatar amarkensteijn avatar ceesvoesenek avatar hvangeffen avatar martinapippi avatar vanmeeuwen avatar saleemtheking avatar kwokkie avatar rdorsman avatar rudieekkelenkamp avatar ekkelenkamp avatar bogaardt avatar

Watchers

Fedor Baart avatar  avatar  avatar  avatar  avatar  avatar

fews-web-oc-charts's Issues

Add scroll zoom to ZoomHandler

  • add scroll zoom to svg
  • emit zoom event with xScalesDomains and yScalesDomains
  • add settings to zoom only on x or y axes
  • add zoom only on x (or y) axis when cursor is above axis
  • add pan

Allow array of data crossSectionSelect

Adjust crossSectionSelect.ts such that it works for a chart with an array of data, such as a chartArea. For a chartArea, draw two circles, one at each end of the area, but only one tag with data. Other chart types might also have an array as data, but might require a different approach

Incorrect display datafield for array of valuefield

If valueField is an array, and not all of the selectors have (non-null) data, the datafield should still display correctly. For instance:

  • Always append a unit (unless some of the datafields have different units.)
  • Only append the hyphen if the next valueField will show anything (i.e. if the next valueField can find data).
  • Apply the dx and dy of each valueField to the individual tspan

Maybe other things should be adjusted as well.

Add zoom method to visitors

All the visitors should have a zoom method which has a start point and end point as argument.

zoom(start, end)

Use vector instead of line in windrose

Application: Make a rose for current as well as for wind. However, the direction of current is opposite that of wind (both have the same value, but the 'arrow points in the opposite direction')

Change the line in the polar plot to an arrow/vector, or add something like a chartVector instead of chartLine

Refactor css

  • single css file
  • sass
  • use dark and light classes

Fix setOptions axis

When the axis options are changed (using setOptions), the Axis is not updated. For instance, of the axis position is set to 'top' initially, but changed to 'bottom' later, then the axis stays at the 'top' position. The setOptions correctly updates this.options, but the Axis / Chart is not updated.

Add animate option to redraw method

When adding new data to a chart it is not always appropriate to animate the transition from new to old data.
Hence, we should add an option to disable the transition on a redraw.

Include legend in svg

Move the axis to a translated group and add the legend on top, bottom, left or right.

Create axis group

Create an svg group for all axis (not grid lines). Can have an influence on the css selectors.

Refactor determineLabel

determineLabel is used in both crossSectionSelect.ts and mouseOver.ts, and is (nearly) identical. In addition, the label depends more on the type of chart than on the type of visitor. So move determineLabel to (each) chart. See also #43 (comment) for background.

CrossSelect for charts with same id

You can add charts with the same id. They are grouped in the legend.
Sometime this is done for combining a chartMarker and chartLine which have the same data.
Now two labels are drawn.

Fix error when using this library

ERROR in ./node_modules/@deltares/fews-web-oc-charts/lib/esm/Axis/axis.js 48:26-37
export 'default' (imported as 'd3') was not found in 'd3'

Fix examples to work with CSP

Add a serve.json file with CSP headers.

Inline script and style are not allowed. Separate examples in *.html, *.js and *.css files.

CSP strict

At the moment we need CSP header due to the tooltip rendering html from string.
Content-Security-Policy: style-src 'unsafe-inline';

Fix resize when chart is removed

When a chart is closed, such that the path is no longer present, calling resize() on the axis gives an Error: transition xx not found for some charts. This does not happen for ChartLine, but does happen for (at least) ChartRange and ChartHistogram.

Add ES module build

See Deltares/fews-pi-requests#69 for more details how to add Ecmascript as build output and enable ES support in Jest.

The following steps are necessary.

  • Add type=module in package.json, this will ensure the node treats als Javascript files as Ecmascript
  • Convert .esltintrc.js to .eslintrc.cjs to ensure the node will treat it as Common JS (with require)
  • Add a build:esm step in package.json to generate Ecmascript module "build:esm": "tsc", change the "tsconfig.json" file to output types to "declarationDir": "lib/types", and output "outDir": "lib/esm"
  • Convert webpack.js to Ecmascript module (replace requre with import), change the entry for webpack to entry: './lib/esm/index.js', the ts-loader plugin is no longer required
  • In package.json include the lib directory in the "files" : [ "dist/*", "lib/*" ] entry.
  • Add a build:cjs step in package.json to generate Commonjs to "lib/esm" "build:cjs": "tsc --module commonjs --outDir lib/cjs"
  • Change all imports to full path, (see below)
  • Change the jest.config.js to jest.config.cjs and enable Ecmascript support for testing
    preset: 'ts-jest/presets/default-esm', // or other ESM presets
    moduleNameMapper: {
      '^(\\.{1,2}/.*)\\.js$': '$1',
    },
    transform: {
        '^.+\\.[tj]sx?$': ['ts-jest', { useESM: true } ]
    },

Fully specified imports

For Ecmascript it is required the all imports are specified as a full path.

So the import

import { TooltipAnchor, TooltipPosition } from '../Tooltip';

must be changed to

import { TooltipAnchor, TooltipPosition } from '../Tooltip/tooltip.js';

For the index.ts files change

export * from './axis'

to

export * from './axis.js

Even when working with Typescript the import statement should specify the .js extension.

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.