Giter Club home page Giter Club logo

d3plus-plot's Introduction

d3plus-plot

A reusable javascript x/y plot built on D3.

Installing

If using npm, npm install d3plus-plot. Otherwise, you can download the latest release from GitHub or load from a CDN.

import modules from "d3plus-plot";

d3plus-plot can be loaded as a standalone library or bundled as part of D3plus. ES modules, AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3plus global is exported:

<script src="https://cdn.jsdelivr.net/npm/d3plus-plot@1"></script>
<script>
  console.log(d3plus);
</script>

Examples

Live examples can be found on d3plus.org, which includes a collection of example visualizations using d3plus-react. These examples are powered by the d3plus-storybook repo, and PRs are always welcome. 🍻

API Reference


AreaPlot <>

This is a global class, and extends all of the methods and functionality of Plot.

# new AreaPlot()

Creates an area plot based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .baseline(0)
  .discrete("x")
  .shape("Area")

BarChart <>

This is a global class, and extends all of the methods and functionality of Plot.

# new BarChart()

Creates a bar chart based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .baseline(0)
  .discrete("x")
  .shape("Bar")

BoxWhisker <>

This is a global class, and extends all of the methods and functionality of Plot.

# new BoxWhisker()

Creates a simple box and whisker based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .discrete("x")
  .shape("Box")

BumpChart <>

This is a global class, and extends all of the methods and functionality of Plot.

# new BumpChart()

Creates a bump chart based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .discrete("x")
  .shape("Line")
  .x("x")
  .y2(d => this._y(d))
  .yConfig({
    tickFormat: val => {
      const data = this._formattedData;
      const xDomain = this._xDomain;
      const startData = data.filter(d => d.x === xDomain[0]);
      const d = startData.find(d => d.y === val);
      return this._drawLabel(d, d.i);
     }
   })
  .y2Config({
    tickFormat: val => {
      const data = this._formattedData;
      const xDomain = this._xDomain;
      const endData = data.filter(d => d.x === xDomain[xDomain.length - 1]);
      const d = endData.find(d => d.y === val);
      return this._drawLabel(d, d.i);
     }
   })
  .ySort((a, b) => b.y - a.y)
  .y2Sort((a, b) => b.y - a.y)

LinePlot <>

This is a global class, and extends all of the methods and functionality of Plot.

# new LinePlot()

Creates a line plot based on an array of data.

the equivalent of calling:

new d3plus.Plot()
  .discrete("x")
  .shape("Line")

Plot <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Plot()

Creates an x/y plot based on an array of data.

# Plot.annotations(annotations) <>

Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the Shape class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which Shape sub-class to use (Rect, Line, etc).

Additionally, each config object can also contain an optional "layer" key, which defines whether the annotations will be displayed in "front" or in "back" of the primary visualization shapes. This value defaults to "back" if not present.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.axisPersist([value]) <>

Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to true to make the axes stay consistent when the timeline changes).

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.backgroundConfig([value]) <>

A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.barPadding(value) <>

Sets the pixel space between each bar in a group of bars.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.baseline(value) <>

Sets the baseline for the x/y plot. If value is not specified, returns the current baseline.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.buffer([value]) <>

Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be true or false to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. {Bar: false, Circle: true, Line: false}).

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.confidence(value) <>

Sets the confidence to the specified array of lower and upper bounds.

This is a static method of Plot, and is chainable with other methods of this Class. Can be called with accessor functions or static keys:

       var data = {id: "alpha", value: 10, lci: 9, hci: 11};
       ...
       // Accessor functions
       .confidence([function(d) { return d.lci }, function(d) { return d.hci }])

       // Or static keys
       .confidence(["lci", "hci"])

# Plot.confidenceConfig([value]) <>

If value is specified, sets the config method for each shape rendered as a confidence interval and returns the current class instance.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.discrete(value) <>

Sets the discrete axis to the specified string. If value is not specified, returns the current discrete axis.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.discreteCutoff(value) <>

When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to 0 to disable the behavior entirely.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.groupPadding([value]) <>

Sets the pixel space between groups of bars.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.labelConnectorConfig([value]) <>

The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.lineLabels([value]) <>

Draws labels on the right side of any Line shapes that are drawn on the plot.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.lineMarkerConfig(value) <>

Shape config for the Circle shapes drawn by the lineMarkers method.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.lineMarkers([value]) <>

Draws circle markers on each vertex of a Line.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.shapeSort(value) <>

A JavaScript sort comparator function that receives each shape Class (ie. "Circle", "Line", etc) as it's comparator arguments. Shapes are drawn in groups based on their type, so you are defining the layering order for all shapes of said type.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.size(value) <>

Sets the size of bubbles to the given Number, data key, or function.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.sizeMax(value) <>

Sets the size scale maximum to the specified number.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.sizeMin(value) <>

Sets the size scale minimum to the specified number.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.sizeScale(value) <>

Sets the size scale to the specified string.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.stacked(value) <>

If value is specified, toggles shape stacking. If value is not specified, returns the current stack value.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.stackOffset(value) <>

Sets the stack offset. If value is not specified, returns the current stack offset function.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.stackOrder(value) <>

Sets the stack order. If value is not specified, returns the current stack order function.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.x(value) <>

Sets the x accessor to the specified function or number. If value is not specified, returns the current x accessor.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.x2(value) <>

Sets the x2 accessor to the specified function or number. If value is not specified, returns the current x2 accessor.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.xConfig(value) <>

A pass-through to the underlying Axis config used for the x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.xCutoff(value) <>

When the width of the chart is less than or equal to this pixel value, and the x-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to 0 to disable the behavior entirely.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.x2Config(value) <>

A pass-through to the underlying Axis config used for the secondary x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.xDomain(value) <>

Sets the x domain to the specified array. If value is not specified, returns the current x domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.x2Domain(value) <>

Sets the x2 domain to the specified array. If value is not specified, returns the current x2 domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.xSort(value) <>

Defines a custom sorting comparitor function to be used for discrete x axes.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.x2Sort(value) <>

Defines a custom sorting comparitor function to be used for discrete x2 axes.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.y(value) <>

Sets the y accessor to the specified function or number. If value is not specified, returns the current y accessor.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.y2(value) <>

Sets the y2 accessor to the specified function or number. If value is not specified, returns the current y2 accessor.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.yConfig(value) <>

A pass-through to the underlying Axis config used for the y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data. Note:* If a "domain" array is passed to the y-axis config, it will be reversed.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.yCutoff(value) <>

When the height of the chart is less than or equal to this pixel value, and the y-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to 0 to disable the behavior entirely.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.y2Config(value) <>

A pass-through to the underlying Axis config used for the secondary y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.yDomain(value) <>

Sets the y domain to the specified array. If value is not specified, returns the current y domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.y2Domain(value) <>

Sets the y2 domain to the specified array. If value is not specified, returns the current y2 domain. Additionally, if either value of the array is undefined, it will be calculated from the data.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.ySort(value) <>

Defines a custom sorting comparitor function to be used for discrete y axes.

This is a static method of Plot, and is chainable with other methods of this Class.

# Plot.y2Sort(value) <>

Defines a custom sorting comparitor function to be used for discrete y2 axes.

This is a static method of Plot, and is chainable with other methods of this Class.


Radar <>

This is a global class, and extends all of the methods and functionality of Viz.

# new Radar()

Creates a radar visualization based on an array of data.

# Radar.axisConfig(value) <>

Sets the config method used for the radial spokes, circles, and labels.

This is a static method of Radar, and is chainable with other methods of this Class.

# Radar.metric(value) <>

Defines the value used as axis. If value is specified, sets the accessor to the specified metric function. If value is not specified, returns the current metric accessor.

This is a static method of Radar, and is chainable with other methods of this Class.

# Radar.outerPadding([value]) <>

Determines how much pixel spaces to give the outer labels.

This is a static method of Radar, and is chainable with other methods of this Class.

# Radar.value(value) <>

If value is specified, sets the value accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current value accessor.

This is a static method of Radar.

function value(d) {
  return d.value;
}

StackedArea <>

This is a global class, and extends all of the methods and functionality of Area.

# new StackedArea()

Creates a stacked area plot based on an array of data.

the equivalent of calling:

new d3plus.AreaPlot()
  .stacked(true)

Documentation generated on Tue, 14 May 2024 19:25:39 GMT

d3plus-plot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

d3plus-plot's Issues

create shorthand for BumpChart

assuming that the data provided for the y-axis is an integer rank:

  • change default y-axis sorting
  • show labels instead of values on both y-axes

respect xSort/ySort when sorting data by discrete value

Expected Behavior

If the user supplies a specific sort function, use that when sorting the data.

Current Behavior

Currently, if a custom sort is provided (like for strings), the custom sort is not used and lines draw really weird. I would start by looking at lines 186, 226, and 264 of src/Plot.js.

Steps to Reproduce (for bugs)

https://jsfiddle.net/5hafqu6b/2/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: macOS High Sierra

Stacked Areas: Weird label Behavior on hover

Expected Behavior

Label does not move on hover.

Current Behavior

Labels duplicate and slow tooltip transitions

Steps to Reproduce (for bugs)

ene-03-2018 09-45-48

Your Environment

  • Browser Name: chrome
  • Operating System and Version: ios

After d3plus update d3plus-plot stop working

After the last update of datawheel-canon v.0.10.0 that use lastest version of d3plus, some plot charts stop working.
Are there changes on config settings?

Steps to Reproduce (for bugs)

  1. The config:
<LinePlot
            config={{
              height: 500,
              data: path,
              groupBy: "variable",
              x: "ID Year",
              y: "value"
            }}
            dataFormat={data =>
              melt(data.data, ["ID Year"], ["FOB", "CIF", "Trade Balance"])}
          />
  1. The data (result of melt function)
[
{ID Year: 1999, variable: "FOB", value: null},
{ID Year: 1999, variable: "CIF", value: 390666793.2382602},
{ID Year: 1999, variable: "Trade Balance", value: -390666793.2382602},
{ID Year: 2000, variable: "FOB", value: null},
{ID Year: 2000, variable: "CIF", value: 699033236.8357185},
{ID Year: 2000, variable: "Trade Balance", value: -699033236.8357185},
{ID Year: 2001, variable: "FOB", value: null},
{ID Year: 2001, variable: "CIF", value: 815740186.0119082},
{ID Year: 2001, variable: "Trade Balance", value: -815740186.0119082}
...
]
  1. The chart looks like:

captura de pantalla 2017-09-06 a las 2 02 07 p m

Your Environment

  • Browser Name: chome
  • Operating System and Version: mac osx El Capitán

x-axis labels get thrown off in some smaller windows

screen shot 2017-06-07 at 4 05 05 pm

Expected Behavior

Bars do not overlap with labels and labels remain below the x-axis (in some scenarios I've seen the x-axis tick labels go above? will try to reproduce that too.)

Current Behavior

Bars start to overlap with labels

Steps to Reproduce (for bugs)

  1. goto https://jsfiddle.net/wsm8g7Lg/2/
  2. shrink the width of the quadrant that displays the viz.
  3. click "Run" to rerender, when I do this I see the error in the screenshot included above

Your Environment

  • Browser Name: chrome
  • Operating System and Version: mac

bump charts erroring out when unique group by is not always present

Using the sample bump chart as an example: http://d3plus.org/examples/d3plus-plot/bump-chart/

When a particular fruit does not appear in a particular year, the viz errors out with the following error:

BumpChart.js:54 Uncaught (in promise) TypeError: Cannot read property 'i' of undefined
    at tickFormat (BumpChart.js:54)
    at eval (Axis.js:406)
    at Array.map (<anonymous>)
    at AxisLeft.render (Axis.js:394)
    at BumpChart._draw (Plot.js:416)
    at Queue.eval [as _call] (Viz.js:487)
    at maybeNotify (queue.js:115)
    at Queue.awaitAll (queue.js:46)
    at BumpChart.render (Viz.js:485)
    at BumpChart.renderViz (Viz.js:69)

More specifically it only seems to happen when a fruit is missing for the first or last years, take a look here:

https://jsfiddle.net/aljaffe/jdbn220u/26/

The last data item {fruit: "orange", label: "Orange", year: 3, rank: 4} was removed to cause the error. Putting it back in fixes it.

An in-range update of d3plus-axis is breaking the build 🚨

Version 0.3.25 of d3plus-axis just got published.

Branch Build failing 🚨
Dependency d3plus-axis
Current Version 0.3.24
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As d3plus-axis is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v0.3.25
  • implements an stepped offset for overlapping labels (0d48677)
  • fixes label edge buffer when flipping axis (d78f62d)
  • moves Axis render function to top of file (bc77b7e)
  • chore(package): update d3-array to version 1.1.0 (#29) (4636084)
  • updates d3plus-dev to v0.3.0 (0efbe46)
Commits

The new version differs by 6 commits .

  • 0d48677 implements an stepped offset for overlapping labels
  • d78f62d fixes label edge buffer when flipping axis
  • bc77b7e moves Axis render function to top of file
  • 4636084 chore(package): update d3-array to version 1.1.0 (#29)
  • 0efbe46 updates d3plus-dev to v0.3.0
  • bff17a6 compiles v0.3.24

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

bug with bars extending over axis

Expected Behavior

Expect bars to fit within axes

Current Behavior

With a smaller visualization on mobile, the bars some times go over the axis:

screen shot 2018-04-18 at 4 39 44 pm

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/qwg4dgL4/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: Latest OS X

error in points when applying log scale

Expected Behavior

Would expect to see a log scale of the data

Current Behavior

I can see a log scale of the data, but the points has a weird alignment over the axis.

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/u6krvw5y/1/

Your Environment

  • Browser Name: Google Chrome
  • Operating System and Version: MacOS High Sierra

user-definable max-height for the x-axis

Expected Behavior

On a viz with long labels that don't fit horizontally, rotate the labels, but cap the length at some value (could be nice to have a default max length and also ability for users to override)

Current Behavior

With lots of data and long labels I get no viz :(

screen shot 2018-04-18 at 4 49 25 pm

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/5yjhnb2v/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: OS X 10.13.4

allow labels to appear outside the bar in horizontal barcharts

Currently, the horizontal barchart doesn't show the label of a bar if the text doesn't fit inside the width of the bar, which usually means the value is very low and there's a good amount of empty space right next to the bar, like in this example:
image
The ideal situation would be using that empty space to show the label of the bar.

Plot-chart weird render issue

Weird render issue.

Expected Behavior

Render the lines in a proper way.

Current Behavior

Weird hops at the end of each line. ¿data problem?
sept-15-2017 17-42-01

Steps to Reproduce (for bugs)

  1. Check this live example: https://jsfiddle.net/palamago/m4svsfzp/1/
    Consideration 1: Not sure if I'm using the x axis properly, its a date. Maybe here is the problem.
    Consideration 2: I'm using d3plus react components.

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: OSX

timeline does not work in BumpChart

Expected Behavior

When changing the timeline, the x-axis should change to reflect the new data.

Current Behavior

It seems like the value for the x-axis is currently being determined by the overall data, and not the filteredData.

Steps to Reproduce (for bugs)

http://jsfiddle.net/4cbyf9o3/2/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: macOS High Sierra

An in-range update of d3-shape is breaking the build 🚨

Version 1.0.6 of d3-shape just got published.

Branch Build failing 🚨
Dependency d3-shape
Current Version 1.0.5
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As d3-shape is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v1.0.6
  • Update dependencies.
Commits

The new version differs by 2 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

maximum call stack size exceeded in Google Chrome

Expected Behavior

Trying to draw a bar chart in a JSfiddle using latest v7 d3plus plot, gives an error. Only seems to happen in chrome.

Current Behavior

No chart renders instead I get the error:

d3plus-plot.v0.7.full.min.js:7 Uncaught RangeError: Maximum call stack size exceeded
    at Array.forEach (<anonymous>)
    at n (d3plus-plot.v0.7.full.min.js:7)
    at x (d3plus-plot.v0.7.full.min.js:7)
    at d3plus-plot.v0.7.full.min.js:7
    at Array.forEach (<anonymous>)
    at n (d3plus-plot.v0.7.full.min.js:7)
    at x (d3plus-plot.v0.7.full.min.js:7)
    at d3plus-plot.v0.7.full.min.js:7
    at Array.forEach (<anonymous>)
    at n (d3plus-plot.v0.7.full.min.js:7)

Steps to Reproduce (for bugs)

  1. Goto https://jsfiddle.net/Lya86tv1/1/
  2. change v0.6 to v0.7
  3. click run

Your Environment

  • Browser Name: Chrome 67
  • Operating System and Version: Operating system OS X 10.13

setting time breaks BumpChart y labels

Expected Behavior

Setting the .time( ) method should have little to no effect on simple Bump Charts.

Current Behavior

Both sets of y-axis labels become hidden. It is probably an issue with the default tickFormat functions defined in the constructor.

Steps to Reproduce (for bugs)

http://jsfiddle.net/4cbyf9o3/1/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: macOS High Sierra

line charts rendering incorrectly

When trying to display a line chart visualization, the lines are not drawn as expected the line segments seem like they are getting drawn out of order.

Expected Behavior

To see the line rendered correctly as shown in this image:
screen shot 2018-04-03 at 10 54 17 am

Current Behavior

Incorrect line chart rendering as shown in this image:

screen shot 2018-04-03 at 10 53 37 am

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/zk5hnyLc/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: OS X 10.13.3

An in-range update of d3-scale is breaking the build 🚨

Version 1.0.5 of d3-scale just got published.

Branch Build failing 🚨
Dependency d3-scale
Current Version 1.0.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As d3-scale is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details
Release Notes v1.0.5
  • Update dependencies.
Commits

The new version differs by 2 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

support tidy data format for multi-series line plots

Hey @davelandry,

Most charting tools I'm familiar with, use the convention of representing data series in the table's columns. That is, they follow the tidy data format. For drawing a multi-series line plot, d3plus expects molten data. From the paper:

screen shot 2016-11-22 at 2 57 06 pm

This is purely conventional, of course: transforming a molten table into a tidy one is just a pivot operation away.

strokeWidth not applied to LinePlot?

Expected Behavior

User can vary the stroke width of a plotted line

Current Behavior

Setting the strokeWidth doesn't seem to change the width of the line

{
  shapeConfig: {Path: {
    stroke: "rgba(7, 94, 128, 0.5)",
    strokeWidth: "4px"
  }
}

Steps to Reproduce (for bugs)

See https://jsfiddle.net/hxwn785q/1/

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: OS X

stroke colors not properly applied

When applying the stroke option for a Line inside a shapeConfig, the colors do not appear appropriately on different lines

Expected Behavior

Multiple colored lines

Current Behavior

Lines appear as the same color

Steps to Reproduce (for bugs)

        <LinePlot config={{
          data,
          discrete: "x",
          height: 500,
          label: d => titleCase(d["Occupied By"]),

          legend: true,
          groupBy: "Occupied By",
          shapeConfig: {
            Line: {
              strokeWidth: 3,
              stroke: d => d["Occupied By"] === "renter" ? "red" : "blue"
            }
          },
          x: "Year",
          xConfig: {
            title: "Year"
          },
          time: "Year",
          tooltipConfig: {
            body: tooltipBody.bind(["Population Sum"])
          },
          y: "Population Sum",
          yConfig: {
            title: "Population",
            tickFormat: d => abbreviate(d)
          },
          yDomain: [0]
        }} />

Your Environment

  • Browser Name:
  • Operating System and Version:

error when passing empty data array to BarChart

d3plus-plot.v0.5.full.min.js:7 Uncaught TypeError: Cannot read property 'xlabel' of undefined
    at e._x (d3plus-plot.v0.5.full.min.js:7)
    at e.t [as _draw] (d3plus-plot.v0.5.full.min.js:7)
    at e [as _draw] (d3plus-plot.v0.5.full.min.js:7)
    at fg._call (d3plus-plot.v0.5.full.min.js:7)
    at yg (d3plus-plot.v0.5.full.min.js:7)
    at fg.awaitAll (d3plus-plot.v0.5.full.min.js:7)
    at e.t [as render] (d3plus-plot.v0.5.full.min.js:7)
    at window.onload ((index):66)

where xlabel is the value passed as x in the viz config

Example fiddle: https://jsfiddle.net/g7bqntse/

support confidence interval for lines

for line charts, it would be great to be able to show lower and upper confidence intervals like this:

screen shot 2018-03-13 at 1 28 40 pm

I'm envisioning a .confidence( ) method, which accepts an array of accessors for the lower and upper bounds:

  • add confidence method, which accepts an array of 2 values, and converts any String values into accessor functions
  • in src/Plot.js, during the shape draw for loop, and a catch for when d.key === "Line" && this._confidence to draw Area shapes before/behind the Lines that are about to be drawn. We should be able to use the config from here, while just overriding the non-discrete axis values and the fill opacity (let's start with 0.5 as a default)

bars not aligning with x-axis after changing years

Expected Behavior

With no negative values, bars will remain fixed on x-axis.

Current Behavior

If selecting year 2013 then 2014 .. for some reason the bars seem to jump off the x-axis? For some reason the 0 value seems to get some padding added underneath and no longer lies on the x-axis

Steps to Reproduce (for bugs)

  1. https://jsfiddle.net/72zs3dm0/
  2. Click 2013
  3. Click 2014

Your Environment

  • Browser Name: Chrome
  • Operating System and Version: OS X 10.13.3

An in-range update of d3-array is breaking the build 🚨

Version 1.0.3 of d3-array just got published.

Branch Build failing 🚨
Dependency d3-array
Current Version 1.0.2
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

As d3-array is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Release Notes v1.0.3
  • Update dependencies.
Commits

The new version differs by 6 commits .

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

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.