Git Product home page Git Product logo

updating-radar-chart's Introduction

reusable updating radarChart

Design based on original by NadiehBremer at Visual Cinnamon

Coding philosophy inspired by Rob Moore

I figured out enter/exit/update for nested objects by studying Lee Mendelowitz's block and reviewing Mike's comments

Features:

  • Separate layer for hover objects which need to remain on top of chart
  • Separate layer for tooltip which needs to be uppermost layer
  • Events are configurable as options such that external functions can be seamlessly integrated
  • e.g. external tooltips can be configured for mouseover events

Accessors:

by default accessors with no parameters return current values

  • chart.duration(transition-time) // duration of transitions
  • chart.options(object) // many options don't have accessors
  • chart.width(width)
  • chart.height(height)
  • chart.margins(object)
  • chart.data(data) // set data
  • chart.update() // update chart
  • chart.maxValue(value) // maxValue of axis values
  • chart.levels(value) // number of ring levels
  • chart.opacity(value) // opacity of unselected areas
  • chart.borderWidth(value) // width of border surrounding areas
  • chart.rounded(true/false) // select rounded areas
  • chart.events(object) -- chart.events({'legend': {'mouseover': null}})
  • chart.color(d3.scale)
  • chart.colors(object) -- chart.colors({'axis1': 'color1', 'axis2': 'color2'})
operations on data held in chart instance
  • chart.pop()
  • chart.push(row) -or- chart.push([row, row])
  • chart.shift()
  • chart.unshift(row) -or- chart.unshift([row, row])
  • chart.slice(begin, end)
operations performed on data prior to display
  • chart.invert(axis) -or- chart.invert([axis, axis]) // index or "axis label"
  • chart.ranges({'axis': [min, max]})
  • chart.filterAxes('axis') -or- chart.filterAxes(['axis', 'axis'])
  • chart.filterAreas('key') -or- chart.filterAreas(['key1', 'key2'])
convenience
  • chart.keys() // return a list of data keys
  • chart.axes() // return labels of all axes
  • chart.nodes() // return svg object

updating-radar-chart's People

Contributors

tennisvisuals avatar

Stargazers

 avatar Dennis Hilgendorf avatar  avatar Felipe Mattioni Maturana, Ph.D. avatar Benoit Grégoire avatar Andrew Eberbach avatar Austin T avatar Edouard Legoupil avatar Josh Hermsmeyer avatar Travis Taylor avatar Aldo Valverde avatar Martinez-Lopez Javier avatar timelyportfolio avatar

Watchers

timelyportfolio avatar James Cloos avatar Aldo Valverde avatar Subir Rastogi avatar  avatar  avatar

updating-radar-chart's Issues

Potential for removing redundant code?

Thanks for sharing this. I appreciate the very clear spacing of the update, enter, and exit selections.

I am new-ish to d3 so this may be off-base but my reading says that anything processed in the enter section is automatically appended to the update selection.

This means that is you move your update selection code below your enter selection code you should be able to remove all code that is in both the enter and update selections.

I see this in many d3 examples and would guess it is one of the most common mistakes and, like any duplicated code, is an opportunity for inadvertent bugs as the 'duplicate' code sections can diverge.

Hope I am on the right track!

legend click - right area but wrong circle

Clicking on the legend entries causes the area to disappear as I would expect, but the circles to remain. I'll inspect further to see what might be happening. See below for what happens when I click the orange iPhone. That might be the alas that you mention in #3.

image

events with more than one on a page

Sorry to be a pest, but in lines results in problems when more than one exists on a page. In some cases this might be a "feature", but I think in general users might think of it as a bug. Of course, you provide the ability to override this, so maybe you can leave as is.

Perhaps could you limit this to the containing element?

d3.selectAll("." + options.class + "RadarArea")

Probably should have used an animated GIF, but in the screenshot, you can see how hovering in the top chart (green in this case) causes the bottom chart areas to go transparent.

image

filter id conflicts when more than one on a page

Thanks so much for this! I plan to integrate it into an htmlwidget for R. Not sure of the best way to handle this, but I thought I would report one "problem" that I discovered. The filter is assigned an id of glow which means when more than one radar chart exists on a page, we get a conflict and bad behavior. For now I have just turned it off, but it would be nice to have a unique id assigned, so that we can use filter even when multiple radar charts exist on a single page.

namespace tooltip

I also spotted that tooltips are assigned a class of tooltip which makes perfect sense, but unfortunately Bootstrap is not namespaced. I avoid Bootstrap for this reason, but I know many folks rely on it. When radar charts are on the same page as Bootstrap, the .tooltip conflicts and results in styling difficulties.

Would it be possible to namespace the radar chart tooltips with a more unique class, such as radar-tooltip?

Thanks again for this.

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.