Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ekacnet/cubism-es
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.3
Choose a base ref
...
head repository: ekacnet/cubism-es
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 16 commits
  • 38 files changed
  • 1 contributor

Commits on Apr 22, 2024

  1. Reformat rollup config files

    ekacnet committed Apr 22, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    hameerabbasi Hameer Abbasi
    Copy the full SHA
    37b45a7 View commit details
  2. Improve config for rollup

    Get rid of a warning related to babel about using an implicit value.
    Remove warning about circular deps in the dev config, it was already
    done in the usual one.
    
    Change the folders that trigger the reload in the dev config, when
    I first created the file I took inspiration of what was done for
    a grafana plugin but here it's better to monitor 2 folders.
    ekacnet committed Apr 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    85ca037 View commit details
  3. Fix broken variables in the keydown functions

    Note it seems not to produce the behavior expected
    ekacnet committed Apr 22, 2024
    Copy the full SHA
    3cceff0 View commit details
  4. Copy the full SHA
    da9353f View commit details
  5. Add a bit of documentation

    ekacnet committed Apr 22, 2024
    Copy the full SHA
    a47fb24 View commit details
  6. Handle selectAll().node() returning null

    It seems that when used in some react components the function could
    return a null object.
    
    I suspect it's because we have some timeout still running even when the
    component that use cubism is unmounted.
    ekacnet committed Apr 22, 2024
    Copy the full SHA
    ad1db31 View commit details

Commits on Apr 24, 2024

  1. Remove shims for ES6, don't seems to be needed

    ekacnet committed Apr 24, 2024
    Copy the full SHA
    a05224e View commit details

Commits on Apr 29, 2024

  1. Add zooming capabilities

    This should address the issue in BigFatDog#9.
    
    There is two part in the change itself one to allow the user to interact
    with the graph to indicate wich area of the graph should be zoomed and
    one to actually to allow redrawing the graph with zoomed data.
    
    The data model for cubism didn't map very well with the later, metrics
    are meant to be appended on and on and not rewind back in time a replot
    new (more detailed metrics).
    
    So this required a bit more change.
    
    In order to use it add this in the code:
    ```
        const z = d3.select("body").append("div")
            .attr("class", "zoom");
        context.zoom(function(start, end) {
            console.log(`Doing a zoom from point ${start} to point ${end}`);
            context.zoom().zoomTime(start, end);
        }).render(z);
    ```
    ekacnet committed Apr 29, 2024
    Copy the full SHA
    9e8f0d2 View commit details
  2. Support custom class name for horizon, title, ...

    When trying to integrate with Grafana we need to use emotion that
    will generate its own classname instead of well known ones
    ekacnet committed Apr 29, 2024
    Copy the full SHA
    5290a1b View commit details
  3. Fix rollup config to allow typescript files

    Signed-off-by: Matthieu Patou <mat@matws.net>
    ekacnet committed Apr 29, 2024
    Copy the full SHA
    c31359f View commit details
  4. Add unit tests

    ekacnet committed Apr 29, 2024
    Copy the full SHA
    509217f View commit details

Commits on May 1, 2024

  1. Increase coverage by improving e2e and unit testing

    Significantly redesigned the e2e testing to allow testing of zooming and
    checking that values changes if we wait enough in e2e.
    
    Add also unit testing.
    ekacnet committed May 1, 2024
    Copy the full SHA
    1c69705 View commit details
  2. Update README.md to add details about the two root branches.

    ekacnet committed May 1, 2024
    Copy the full SHA
    6f6ba2f View commit details
  3. Fix even more the README

    ekacnet committed May 1, 2024
    Copy the full SHA
    d9802bb View commit details
  4. Update a bunch of deps related to npm

    ekacnet committed May 1, 2024
    Copy the full SHA
    eba07be View commit details

Commits on May 2, 2024

  1. Fix mismatch in the names of artifacts

    The names were not the same between the step that created it and the
    step that downloaded it.
    ekacnet committed May 2, 2024
    Copy the full SHA
    9df4939 View commit details
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -26,15 +26,14 @@ jobs:
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Unit tests
run: npm run test

run: npm install

- name: Build
run: npm run build

- name: Unit tests
run: npm run test:ci

- name: Check for E2E
id: check-for-e2e
run: |
@@ -51,6 +50,10 @@ jobs:
if: steps.check-for-e2e.outputs.has-e2e == 'true'
run: npm run e2e

- name: Merge coverage
if: steps.check-for-e2e.outputs.has-e2e == 'true'
run: npm run report:combined

- name: upload coverage to Codecov
uses: codecov/codecov-action@v4
if: steps.check-for-e2e.outputs.has-e2e == 'true'
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -25,27 +25,29 @@ jobs:
cache: 'npm'

- name: Install dependencies
run: npm ci
run: npm install

- name: Unit tests
run: npm run test
- name: Build
run: npm run build

- name: Unit tests
run: npm run test:ci

- name: Store the artifacts
uses: actions/upload-artifact@v4
with:
name: js-package
name: js-packages
path: dist/

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: get-packages
name: js-packages
path: dist/
- name: Release
uses: softprops/action-gh-release@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ dist
demo/cubism-es.standalone.js
demo/cubism-es.standalone.js.map
cypress/screenshots
.vscode/launch.json
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# cubism-es
[![codecov](https://codecov.io/gh/ekacnet/cubism-es/graph/badge.svg?token=P3QB0BZKKA)](https://codecov.io/gh/ekacnet/cubism-es)

cubism-es is an ES6 module of [cubism](https://github.com/square/cubism), based on d3v7.

> **IMPORTANT** Version 1.1.0 contains api breaks. Please see below for details
@@ -59,8 +61,58 @@ npm run test // run tests only
npm run test:cover // run tests and view coverage report
```

### About vscode
It seems that everybody (almost) is using vscode those days, I'm not (I'm using VIM) but in case you want to use it and do debug here is a config that worked for `launch.json`:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch stock.html",
"type": "firefox",
"request": "launch",
"reAttach": true,
"url": "http://localhost:3004/stock.html",
"webRoot": "${workspaceFolder}",
"tmpDir": "${HOME}/Work/tmp",
"pathMappings": [
{
"url": "http://localhost:3004/stock.html",
"path": "${workspaceFolder}/demo/stock.html"
}
]
}
]
}
```

### About the main and the master branches

In git repositories, main or master are usually considered root branch but you usually have just one of them (either `main` or `master`) not both.

So why 2 here ?, as of Mayu 2024 I (Matthieu) still have hope to get in touch with the original maintainer of `cubism-es` and that's why I maintain a stack of diff against his root branch: `master` but that starts to be annoying when you want to use a more up to date and maintained version, that's why I created the `main` branch with what I think is a stable version of the code.

## Documentation
For more information, please visit square/cubism's [home page](http://square.github.io/cubism/) and [wiki](https://github.com/square/cubism/wiki)
For more information, please visit square/cubism's [home page](http://square.github.io/cubism/) and [wiki](https://github.com/square/cubism/wiki), this version should support the same API.

Starting from `1.2.0` there is a new `zoom` api for `context`, as the name implies it allows to zoom on the horizon(s).
In order to do so add something like this:

```javascript
const z = d3.select("body").append("div")
.attr("class", "zoom");

context.zoom(function(start, end) {
console.log(`Doing a zoom from point ${start} to point ${end}`);
context.zoom().zoomTime(start, end);
}).render(z);
```

The core of the configuration is the function that you pass to `zoom()`, it takes 2 parameters: the start index and the end index of the zoom, it's not time based but pixel based.

You can do pretty much anything you want in the zoom function like actually zooming or calling a different URL with a detailed analysis of the zoom time.
There is a function in the `zoom` module that you can reuse for doing the actual zooming: `zoom().zoomTime()`, your source must be able to provide a fresh array of values to handle the zoom, see examples in the stock or random demo.


## Limitation
Loading