npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@domoinc/positive-negative-filled-line-chart

v3.0.3

Published

PositiveNegativeFilledLineChart - Domo Widget

Downloads

2

Readme

PositiveNegativeFilledLineChart

This is a area line chart that compares possitive and negative data over time.

Configuration Options

avgLabel

Type: string
Default: Average

Label corresponding to middle average line

chartName

Type: string
Default: PositiveNegativeFilledLineChart

Name of chart for reporting

clickable

Type: boolean
Default: false

Are the area slices clicable?

dateString

Type: string
Default: YYYY

The string to use for date parcing

height

Type: number
Default: 250
Units: px

labelTextSize

Type: number
Default: 16
Units: px

Text size of the labels on the right of the chart

lossFillColor

Type: color
Default: #F27E79

Color of the bottom area

lossLineColor

Type: color
Default: #C92E25

Color of the bottom line and the corresponding label value

negLabel

Type: string
Default: Negative

Label corresponding to bottom area

posLabel

Type: string
Default: Positive

Label corresponding to top area

ratioLineColor

Type: color
Default: #333333

Color of the ratio line and the corresponding label value

shouldValidate

Type: boolean
Default: true

Flag for turning off data validation

textFontFamily

Type: string
Default: Open Sans

updateSizeableConfigs

Type: boolean
Default: true

Flag for turning off the mimic of illustrator's scale functionality

valueTextSize

Type: number
Default: 28
Units: px

Text size of the values on the right of the chart

width

Type: number
Default: 250
Units: px

winFillColor

Type: color
Default: #91D0BC

Color of the top area

winLineColor

Type: color
Default: #559E38

Color of the top line and the corresponding label value

xScale

Type: scale
Default: function scale(x) { return linear(x); }

X Scale to use

yScale

Type: scale
Default: function scale(x) { return output(x); }

Y Scale to use

Data Definition

Date

Type: date

Default validate:

function (line) { return new moment(line[0], ['YYYY-MM-DD', '[Week-]ww YYYY', 'YYYY-MMM', 'YYYY']).toDate() !== 'Invalid Date'; }

Default accessor:

function (line) { return moment(line[0], ['YYYY-MM-DD', '[Week-]ww YYYY', 'YYYY-MMM', 'YYYY']).toDate(); }

Losses

Type: number

Default validate:

function (d) { return !isNaN(this.accessor(d)); }

Default accessor:

function (line) { return Number(line[2]); }

Ratio

Type: number

Default validate:

function (d) { return !isNaN(this.accessor(d)); }

Default accessor:

function (line) { return Number(line[3]); }

Wins

Type: number

Default validate:

function (d) { return !isNaN(this.accessor(d)); }

Default accessor:

function (line) { return Number(line[1]); }

Events

Dispatch Events

dispatch:mouseover
dispatch:mouseout
dispatch:click

External Events

external:mouseover
external:mouseout

Example

/*----------------------------------------------------------------------------------
 Create Widget -> index.html

 © 2011 - 2015 DOMO, INC.
 ----------------------------------------------------------------------------------*/

//Setup some fake data
var data = [
	['2014-01-15', 35, -34, (35 + -34)],
	['2014-02-15', 53, -54, (53 + -54)],
	['2014-03-15', 43, -34, (43 + -34)],
	['2014-04-15', 54, -15, (54 + -15)],
	['2014-05-15', 43, -25, (43 + -25)],
	['2014-06-15', 12, -34, (12 + -34)],
	['2014-07-15', 34, -26, (34 + -26)],
	['2014-08-15', 32, -35, (32 + -35)],
	['2014-09-15', 24, -12, (24 + -12)],
	['2014-10-15', 45, -31, (45 + -31)],
	['2014-11-15', 34, -26, (34 + -26)],
	['2014-12-15', 15, -34, (15 + -34)],
	['2015-01-15', 24, -36, (24 + -36)],
	['2015-02-15', 26, -53, (26 + -53)],
	['2015-03-15', 34, -25, (34 + -25)],
	['2015-04-15', 25, -15, (25 + -15)],
	['2015-05-15', 35, -25, (35 + -25)],
	['2015-06-15', 43, -36, (43 + -36)],
	['2015-07-15', 51, -21, (51 + -21)]
];

//Initialze the widget
var chart = d3.select('#vis')
	.append('svg')
	.attr({
		width: 500,
		height: 500
	})
	.append('g')
	.attr('transform', 'translate(4,50)')
	.chart('PositiveNegativeFilledLineChart')
	.c({
		width: 400,
		height: 400,
	});

//Render the chart with data
chart._notifier.showMessage(true);
chart.draw(data);


setTimeout(function() {
	d3.select(chart._layerGroup.selectAll('.hover')[0][10]).style('opacity', 0);
	d3.select(chart._layerGroup.selectAll('.hover')[0][11]).style('opacity', 0.2);
	chart.trigger('external:mouseout', data[10]);
	chart.trigger('external:mouseover', data[11]);
}, 3500)

setTimeout(function() {
	d3.select(chart._layerGroup.selectAll('.hover')[0][11]).style('opacity', 0);
	d3.select(chart._layerGroup.selectAll('.hover')[0][12]).style('opacity', 0.2);
	chart.trigger('external:mouseout', data[11]);
	chart.trigger('external:mouseover', data[12]);
}, 4000)

setTimeout(function() {
	d3.select(chart._layerGroup.selectAll('.hover')[0][12]).style('opacity', 0);
	chart.trigger('external:mouseout', data[12]);
}, 4500)