Giter VIP home page Giter VIP logo

f5 / unovis Goto Github PK

View Code? Open in Web Editor NEW
2.0K 2.0K 40.0 26.28 MB

Modular data visualization framework for React, Angular, Svelte, Vue, and vanilla TypeScript or JavaScript

Home Page: https://unovis.dev

License: Apache License 2.0

Shell 0.05% Dockerfile 0.06% JavaScript 1.40% HTML 0.73% TypeScript 79.03% CSS 1.58% Svelte 3.22% MDX 10.45% Vue 3.48%
angular charts data-visualization graphs maps react svelte vue

unovis's People

Contributors

lee00678 avatar reb-dev avatar rokotyan avatar tasooneasia avatar yanneves avatar zernonia 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

unovis's Issues

Website | Docs | Stacked, Grouped Bar: Ordinal values

We don't support the ordinal scale for XY Components, but many people would like to be able to plot an ordinal bar chart.

In our case, it can be achieved by a) simply using the data index in the X accessor function; and b) providing exact tickValues to the Axis component. That's fairly simple but not obvious and I often receive questions about it. So I think it's work adding information abut that to the Stacked abd Grouped Bar docs as a hint.

Uncaught typeerror when using LeafletFlowMap with react

Running into the following error when attempting to use LeafletFlowMap with react

Capture

My Component:

const FlightMapComponent = (props) => {
  const style = `https://api.maptiler.com/maps/positron/style.json?key=${key}`
  const attribution = [
    `<a href="https://www.maptiler.com/copyright/" target="_blank">MapTiler</a>`,
    `<a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>`
  ]

  return (
    <VisLeafletFlowMap 
      data={data}
      style={style}
      height={600}
    />
  );
}

package.json

"dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@unovis/react": "^1.0.0",
    "@unovis/ts": "^1.0.0",
    "bootstrap": "^5.2.3",
    "react": "^18.2.0",
    "react-bootstrap": "^2.7.0",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.5.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },

Angular 13: Unable to build Cannot find namespace 'TopoJSON'

When trying to build a project with ng serve I get the following errors

Error: node_modules/@unovis/angular/dist/lib/components/topojson-map/topojson-map.component.d.ts:56:16 - error TS2503: Cannot find namespace 'TopoJSON'.

56     topojson?: TopoJSON.Topology;
                  ~~~~~~~~


Error: node_modules/@unovis/ts/components/topojson-map/config.d.ts:9:16 - error TS2503: Cannot find namespace 'TopoJSON'.

9     topojson?: TopoJSON.Topology;
                 ~~~~~~~~

I've added TopoJSON to my package.json but the issue persists. I've added the following packages:

"@types/topojson-specification": "^1.0.2",
"topojson": "^3.0.2",
"topojson-client": "^3.1.0",

However, updating the types in the files to Any fixes the issue. Or just importing TopoJSON into the file explicitly.
Is there something I'm missing in setting up the package? I figure that my tsconfig setup can also be the issue but just wanted to check if you guys have seen this before


Had one more error that was fixed by adding @types/lodash

Error: node_modules/@unovis/ts/core/component/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'lodash'.

1 /// <reference types="lodash" />
                        ~~~~~~

Website | Gallery: Fix dark theme

The gallery page in dark mode doesn't look great; the card titles aren't visible and the thumbnail images look a bit jarring. I think we should add a dark preview png for each example and use built-in ThemedImage component from docusaurus.

Screen Shot 2022-11-21 at 1 43 29 PM

Tooltip triggers on timeline don't seem to work for line/lines and rows

forgive me, I don't have an easy to give a reproduction case via link/fiddle or whatever, but if you add

  • 3 [Timeline.selectors.line]: getTooltipText,
  • 4 [Timeline.selectors.lines]: getTooltipText

to
https://unovis.dev/gallery/view?collection=Lines%20and%20Areas&title=Basic%20Timeline
it does not seem to work as expected. Timeline.selectors.label seemingly does, but the line/lines selectors don't seem to trigger or install the mouseover handlers as I would expect.

Website | Docs: Not working items

Axis

Screen.Recording.2022-11-18.at.2.48.08.PM.web.mp4
Screen.Recording.2022-11-18.at.2.49.01.PM.web.mp4

Two X axes:
Screen Shot 2022-11-18 at 2 52 59 PM

TopoJSONMap

Screen.Recording.2022-11-18.at.2.54.44.PM.web.mp4

Donut

It seems that empty segments are not visible because of the white stroke
https://user-images.githubusercontent.com/755708/202816768-37bdd9b6-a174-4674-b3fe-b636f4a35b40.mp4

Theming

The Theming page doesn't load when you go there from another doc page

Screen.Recording.2022-11-18.at.2.58.35.PM.web.mp4

Graph | Link Labels: Custom `fontSize` values don't work

Discussed in #112

Originally posted by ndtreviv January 20, 2023
I'm using a link label function like so:

  const linkLabel = useCallback((l) => {
    switch (l.type) {
      case 'A': return { text: 'Affiliated With' };
      case 'B': return { text: 'Owned By' };
      case 'C': return { text: 'Resolves To' };
      default: return { text: l.type || 'UNKNOWN' };
    }
  }, []);

And passing it as a property on my <VisGraph ...> object like so:

...
   <VisGraph
      linkLabel={linkLabel}
     ...

The link text is teeny tiny. According to the docs the function should return a GraphCircleLabel object, which looks like this:

type GraphCircleLabel = {
  text: string;
  color?: string | null; // Optional color
  cursor?: string | null; // Optional cursor on hover
  fontSize?: string; // Optional font size as a CSS string
  radius?: number; // Circle radius in pixels
}

So I figured I could increase the link text size slightly by setting the fontSize property, like so:

  const linkLabel = useCallback((l) => {
    switch (l.type) {
      case 'A': return { text: 'Type A', fontSize: '2rem' };
      case 'B': return { text: 'Type B' };
      case 'C': return { text: 'Type C' };
      default: return { text: l.type || 'Unknown' };
    }
  }, []);

But that doesn't work. The label of the Type A link is no different from the rest. I've also tried putting px values in there amongst some other stuff.

What am I doing wrong?

Crosshair: Compatibility with Timeline

the crosshair component as it stands today only operates on the x axis; this doesn't really make sense for a timeline; or at least it usually wont if you have multiple parallel items. having it be rotatable for the y axis would be useful.

Candlestick shape

It would be great to see a candlestick shape included in the library, for financial apps.

Line tooltip - hovered value support

Unovis doesn't seem to support a tooltip for a Line component rendering the value that the user is hovering over. For example:

<VisXYContainer height={500}>
  <VisLine
    data={timeline}  // just {x: number, y: number}[]
    x={(d) => d.x}
    y={(d) => d.y}
  />
  <VisAxis type="x" />
  <VisAxis type="y" />
  <VisTooltip
    triggers={{
      [Line.selectors.line]: (d) => console.log(d),  // *
    }}
  />
</VisXYContainer>

You'll notice the format of the d parameter is:

{
  defined: boolean;
  visible: boolean;
  values: {
    x: number;
    y: number;
    defined: boolean;
    value: number;
  }[];
}

This values field is all data on the line graph; I only want the one value that the user is hovering over. Is this supported?

Website | Gallery: Optimize for phone screens

@reb-dev We have several issues with our Gallery on mobile devices. Let's think how we can fix them:

  • Open in StackBlitz button overlaps with the tabs;
  • On some charts X axis labels overlap;
  • Some charts don't fit well (Sankey, Scatter with FreeBrush)

IMG_3305 IMG_3305
IMG_3305 IMG_3305

Component | Graph: `padAngle` doesn't work well with `showEmptySegments`

When Donut has showEmptySegments turned on and padAngle specified, empty segments become invisible:
Screen Shot 2023-01-20 at 9 10 12 AM

There's another problem related to that. When Donut has an empty segment and showEmptySegments is set to false, padAngle is added twice:
Screen Shot 2023-01-20 at 9 14 16 AM

Initially I thought we can just filter the data by removing empty items when showEmptySegments is showEmptySegments, but it messes up the rendering (colors, ...) because indices of the elements change.

Svelte error when using axis

The error message says Uncaught TypeError: Cannot read properties of undefined (reading 'config')

This seems to only happen when using VisAxis components when the whole component is getting destroyed, typically due to a page navigation.

Package versions:

  • "@sveltejs/kit": "^1.0.0",
  • "svelte": "^3.54.0",
  • "vite": "^4.0.0"
  • "@unovis/svelte": "^1.0.1",
  • "@unovis/ts": "^1.0.1",

I have a local reproduction repo here: https://github.com/vpanyushenko/unovis-svelte-repo and a live version here: https://unovis-svelte-repo-panyushenko.vercel.app/

To reproduce the issue:

  1. Click on the "chart" tab in the header which should successfully load the demo chart.
  2. Click back to the "home" tab and you'll notice it doesn't load. If you open the console, you'll see the error
  3. Refresh the home page
  4. Click on the "chart without axis" tab
  5. Click back to home. This one loads successfully, the only difference is that VisAxis is not being used.

Dependencies: Could not resolve dependency error

Hello,

I wanted to experiment locally with unovis so as a starter, i've told myself i could download from stackblitz one of the gallery (angular) projects but when i run npm install i get:

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"15.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^12.0.3" from @unovis/[email protected]
npm ERR! node_modules/@unovis/angular
npm ERR!   @unovis/angular@"1.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

when i try, in turn, either --force or --legacy-peer-deps, ng serve gives:

An unhandled exception occurred: require() of ES Module /Downloads/set3nr--run/node_modules/@angular/compiler/fesm2015/compiler.mjs not supported.
Instead change the require of /Downloads/set3nr--run/node_modules/@angular/compiler/fesm2015/compiler.mjs to a dynamic import() which is available in all CommonJS modules.

I'm on a Mac M1, and my node version is 19 but downgrading to 16 for instance doesn't help (i get the same errors).
I'm puzzled how come stackblitz can compile and run the project while locally i get these errors. I didn't figure it out how to use the dynamic import, so i was wondering if you might have a suggestion. Btw, the same error with require i see at https://npm.runkit.com/%40unovis%2Fangular.

Thank you!

Sankey: Failed to execute 'getComputedStyle' on 'Window'

When I deploy the Basic Sankey in a Next.js application, I get the following error:

Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at getCSSVariableValue (misc.js:36:12)
    at getCSSVariableValueInPixels (misc.js:39:17)
    at get bleed [as bleed] (index.js:75:167)
    at Sankey._render (index.js:123:25)
    at Sankey.render (index.js:56:14)
    at SingleContainer._render (index.js:82:19)
    at eval (index.js:63:22)

Reproduction: Link

Website | Docs | Theming: Large Size

Along with the dark theme, another common and useful theming scenario is "large size". I think it's mainly applicable to the font size values of labels, and luckily they are all configurable via CSS variables.

@reb-dev Can you please expand our theming doc with that information a little bit? Also I was thinking, maybe we can create a dedicated single class for the "large size" theme (in ts/src/styles) and export it from the library. So everyone who needs it, will be able to simply apply that class to the chart's container.

Next.js: Cannot read properties of undefined (reading 'baseVal')

When I deploy Dagre Layout Graph in a Next.js application, I get the following error during the initial render:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'baseVal')
    at SVGGElement.defaultExtent (zoom.js?287e:25:1)
    at new Gesture (zoom.js?287e:186:1)
    at gesture (zoom.js?287e:178:1)
    at SVGGElement.eval (zoom.js?287e:92:1)
    at Selection.__WEBPACK_DEFAULT_EXPORT__ [as each] (each.js?664a:5:1)
    at zoom.transform (zoom.js?287e:91:1)
    at Selection.__WEBPACK_DEFAULT_EXPORT__ [as call] (call.js?2436:4:1)
    at Graph._fit (index.js?4995:278:1)
    at eval (index.js?4995:121:1)

Any idea how to fix or work around the error?

Website | Gallery: Anchor links

That would be great to add anchor links to the section title and use them in navigation. Currently it's a bit annoying when you open an example and then go back, you'll need to scroll down do that section again.

Screen.Recording.2022-11-21.at.2.35.45.PM.web.mp4

More and better legends

Our main legend component (BulletLegend) is simple, it doesn't cover many common use cases. and we don't have a doc page for it!

It's the time to revisit our legends, add new legend types and write docs for them.

Dependencies: Get rid of lodash

Lodash has given us quite a bit of troubles before with bundling apps that use Unovis, so we've switched to lodash-es instead of lodash.

Since we don't use it extensively, we can try replacing it with our own functions and/or smaller npm packages, which will give us smaller app bundles.

Multi-level Chord Diagram

Multi-level Chord Diagram will be the first component we add to the library after the 1.0.0 release. Our existing component looks great when it has multiple levels:
Image

But its single level version looks confusing because all the links are straight:
Image

Before we release the component, we need to update the link rendering logic to look more like this:
Image.

Once that is done, we can proceed with creating wrappers, writing the docs and adding a Gallery example.

Checklist:

  • Create a new dev app example
  • Update links rendering
  • Create wrappers for React, Angular and Svelte
  • Write documentation
  • Create a Gallery example

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.