Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Commit

Permalink
Update: Add border for legend item (fixes #28) (#103)
Browse files Browse the repository at this point in the history
* Update: Add border for legend item (fixes #28)

* Docs: Fixed renaming of Graph.md

* Chore: Moved panHelpers out of controls folder
  • Loading branch information
abhijit945 committed Oct 17, 2019
1 parent 7b79b8f commit 1c69ed6
Show file tree
Hide file tree
Showing 19 changed files with 410 additions and 328 deletions.
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -104,12 +104,13 @@ npm i @cerner/carbon-graphs --save-dev

## Potential features

- [ ] Upgrade to latest D3 version
- [ ] Scatter-plot graph
- [ ] Area graphs
- [ ] Area spline graphs
- [ ] Bubble graph
- [ ] Upgrade to latest D3 version
- [ ] Support additional themes
- [ ] a11y
- [ ] Area graph
- [ ] Area spline graph
- [ ] Separate graph types to plugin based
- [ ] DST
- [ ] Tick counts
Expand Down
2 changes: 1 addition & 1 deletion build/index.html
Expand Up @@ -14,7 +14,7 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="tooltip" class="tooltip" style="display: none;"></div>
<main id="root"></main>
<div id="root"></div>
<script src="/dist/bundle.js"></script>
</body>
</html>
11 changes: 9 additions & 2 deletions dev/app.less
@@ -1,7 +1,14 @@
body {
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.carbon-graph-container,
.legend-bindto-container {
font-size: 0.75rem;
padding: 5rem 0;
padding: 3rem 0;
}

.bindto-container {
Expand Down Expand Up @@ -60,7 +67,7 @@
display: inline-block;

& .popup-label {
color: #0074b8;
color: #01579b;

&:after {
content: ": ";
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/controls/bar.js
Expand Up @@ -4,7 +4,7 @@ import Carbon from "../../../src/main/js/carbon";
import utils from "../../../src/main/js/helpers/utils";
import { getDemoData } from "../data";
import { loadDatelinePopup, loadTextLabelPopup, loadBarPopup } from "../popup";
import { createPanningControls } from "./panHelpers";
import { createPanningControls } from "../panHelpers";

const tickValues = [
new Date(2018, 0, 1).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/controls/gantt.js
Expand Up @@ -9,7 +9,7 @@ import {
loadTrackLabelPopup,
loadTrackPopup
} from "../popup";
import { createPanningControls } from "./panHelpers";
import { createPanningControls } from "../panHelpers";

const daysToMilliseconds = (d) => 24 * 60 * 60 * 1000 * d;
const scheduled = {
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/controls/line.js
@@ -1,7 +1,7 @@
import Carbon from "../../../src/main/js/carbon";
import utils from "../../../src/main/js/helpers/utils";
import { getDemoData } from "../data";
import { createPanningControls } from "./panHelpers";
import { createPanningControls } from "../panHelpers";

const tickValues = [
new Date(2016, 0, 1, 1, 0).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/controls/pairedResult.js
Expand Up @@ -2,7 +2,7 @@ import Carbon from "../../../src/main/js/carbon";
import utils from "../../../src/main/js/helpers/utils";
import { getDemoData } from "../data";
import { loadDatelinePopup } from "../popup";
import { createPanningControls } from "./panHelpers";
import { createPanningControls } from "../panHelpers";

const tickValues = [
new Date(2016, 0, 1, 1, 0).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion dev/examples/controls/timeline.js
@@ -1,7 +1,7 @@
import Carbon from "../../../src/main/js/carbon";
import { getDemoData } from "../data";
import utils from "../../../src/main/js/helpers/utils";
import { createPanningControls } from "./panHelpers";
import { createPanningControls } from "../panHelpers";

export const renderTimeline = (id) => {
const timelineDefault = Carbon.api.timeline(
Expand Down
18 changes: 12 additions & 6 deletions dev/examples/controls/panHelpers.js → dev/examples/panHelpers.js
@@ -1,13 +1,14 @@
import d3 from "d3";
import Carbon from "../../../src/main/js/carbon";
import Carbon from "../../src/main/js/carbon";
import {
LEFT_CHEVRON,
RIGHT_CHEVRON
} from "../../../src/main/js/core/Shape/shapeDefinitions";
} from "../../src/main/js/core/Shape/shapeDefinitions";

/**
* Creats Panning container to hold the navigation buttons
* Creates Panning container to hold the navigation buttons
*
* @private
* @param {Array} container - Contains array of the html elements
* @returns { HTMLElement } return html element
*/
Expand All @@ -17,6 +18,7 @@ const createPanningContainer = (container) =>
/**
* createNavigationButton to control the graph movement
*
* @private
* @param {Array} container - container we need to append the navigation button
* @param {object} icon - icon to add inside the buttons
* @param {Function} action - function to move to graph
Expand All @@ -39,8 +41,9 @@ const createNavigationButton = (container, icon, action, className) =>
);

/**
*moveLeftHandler moves the graph to left on click of the button
* moveLeftHandler moves the graph to left on click of the button
*
* @private
* @param {object} graphOptions - graph object which we have to re-create
* @param {object} shift - rate by which we have to shift
* @returns {object} returns the update axis to re-create the graph
Expand All @@ -55,8 +58,9 @@ const moveLeftHandler = (graphOptions, shift) => () => {
};

/**
*moveRightHandler moves the graph to left on click of the button
* moveRightHandler moves the graph to left on click of the button
*
* @private
* @param {object} graphOptions - graph object which we have to re-create
* @param {object} shift - rate by which we have to shift
* @returns {object} returns the update axis to re-create the graph
Expand All @@ -71,8 +75,9 @@ const moveRightHandler = (graphOptions, shift) => () => {
};

/**
*createPanningControls to create the navigation button with the click handler
* createPanningControls to create the navigation button with the click handler
*
* @private
* @param {string} id - id of the div where we have to insert the navigation buttons
* @param {object} graphOptions - graph data to perform operations on the graph
* @returns {undefined} returns nothing
Expand All @@ -97,4 +102,5 @@ const createPanningControls = (id, graphOptions) => {
"nav-right"
);
};

export { createPanningControls, moveRightHandler, moveLeftHandler };
36 changes: 18 additions & 18 deletions docs/contributing/README.md
Expand Up @@ -2,20 +2,20 @@

Thanks for contributing to Carbon! :1st_place_medal: :1st_place_medal:

- [Contributing to Carbon](#Contributing-to-Carbon)
- [Code of Conduct](#Code-of-Conduct)
- [Consumers](#Consumers)
- [Developers](#Developers)
- [Development](#Development)
- [Pulling in dependencies](#Pulling-in-dependencies)
- [Building the project](#Building-the-project)
- [Code Review](#Code-Review)
- [Pull Request checklist](#Pull-Request-checklist)
- [Commit message format](#Commit-message-format)
- [Pull Request](#Pull-Request)
- [Release](#Release)
- [Deploying the site to GitHub](#Deploying-the-site-to-GitHub)
- [Breaking changes](#Breaking-changes)
- [Contributing to Carbon](#contributing-to-carbon)
- [Code of Conduct](#code-of-conduct)
- [Consumers](#consumers)
- [Developers](#developers)
- [Development](#development)
- [Pulling in dependencies](#pulling-in-dependencies)
- [Building the project](#building-the-project)
- [Code Review](#code-review)
- [Pull Request checklist](#pull-request-checklist)
- [Commit message format](#commit-message-format)
- [Pull Request](#pull-request)
- [Release](#release)
- [Deploying the site to GitHub](#deploying-the-site-to-github)
- [Breaking changes](#breaking-changes)

This project uses NPM for dependency management and provides NPM scripts to call on `Webpack` to run tasks on the project.
To get started, you will need to checkout this project.
Expand Down Expand Up @@ -47,27 +47,27 @@ Before starting development on a Carbon project, please complete the following s

After checking out the project, you will want to run the following command to pull in dependencies needed by the project:

```
```sh
npm install
```

When contributing to Carbon, you would need to run the below command and load the test page. The test page auto reloads whenever you make any changes to the .CSS, .JS files or if you make any changes to the sample .html file

```
```sh
npm run dev
```

Open in browser:

```
```sh
http://localhost:9991/
```

#### Building the project

To build the project, run the build script:

```
```sh
npm run build && npm run build:dist
```

Expand Down
File renamed without changes.

0 comments on commit 1c69ed6

Please sign in to comment.