├── .circleci
└── config.yml
├── .env
├── .env.development
├── .env.production
├── .flowconfig
├── .gitignore
├── LICENSE
├── README.md
├── cypress.config.js
├── cypress
├── e2e
│ └── spec.cy.js
├── fixtures
│ ├── profile.json
│ └── queryResponse.json
├── plugins
│ └── index.js
└── support
│ ├── commands.js
│ ├── component-index.html
│ ├── component.js
│ └── e2e.js
├── docs
├── cb_Build Chart.png
├── cb_Chart Builder_Create Insight.gif
├── cb_Chart Builder_Save and Share.gif
├── cb_Chart Options_Left.gif
├── cb_Name Your Chart.png
├── cb_Vega-Lite Editor.png
├── cb_build-chart.png
├── cb_edit-chart.png
├── cb_view-chart.png
├── dw+cb_light.png
└── index.html
├── package.json
├── public
├── favicon.ico
├── index.html
└── manifest.json
├── renovate.json
├── src
├── components
│ ├── CopyField.js
│ ├── DWDatasetModal.js
│ ├── DatasetSelector.js
│ ├── DownloadButton.js
│ ├── DownloadButton.module.css
│ ├── Editor.js
│ ├── Editor.module.css
│ ├── Encoding.js
│ ├── Encoding.module.css
│ ├── FieldSelect.js
│ ├── GlobalOptions.js
│ ├── GlobalOptions.module.css
│ ├── Header.js
│ ├── LicenseModal.js
│ ├── LicenseModal.module.css
│ ├── LoadingAnimation.js
│ ├── LoadingAnimation.module.css
│ ├── Modals.module.css
│ ├── ResizableVegaLiteEmbed.js
│ ├── ResizableVegaLiteEmbed.module.css
│ ├── SaveAsFileModal.js
│ ├── SaveAsInsightModal.js
│ ├── Sidebar.js
│ ├── Sidebar.module.css
│ ├── SidebarFooter.js
│ ├── SidebarFooter.module.css
│ ├── SimpleSelect.js
│ ├── VegaLiteEmbed.js
│ ├── VegaLiteImage.js
│ ├── VizCard.js
│ ├── VizCard.module.css
│ ├── VizEmpty.js
│ ├── VizEmpty.module.css
│ ├── __tests__
│ │ ├── CopyField.spec.js
│ │ ├── DatasetSelector.spec.js
│ │ ├── DownloadButton.spec.js
│ │ ├── Encoding.spec.js
│ │ ├── FieldSelect.spec.js
│ │ ├── GlobalOptions.spec.js
│ │ ├── Header.spec.js
│ │ ├── LoadingAnimation.spec.js
│ │ ├── ResizableVegaLiteEmbed.spec.js
│ │ ├── Sidebar.spec.js
│ │ ├── SidebarFooter.spec.js
│ │ ├── VizCard.spec.js
│ │ ├── VizEmpty.spec.js
│ │ └── __snapshots__
│ │ │ ├── CopyField.spec.js.snap
│ │ │ ├── DatasetSelector.spec.js.snap
│ │ │ ├── DownloadButton.spec.js.snap
│ │ │ ├── Encoding.spec.js.snap
│ │ │ ├── FieldSelect.spec.js.snap
│ │ │ ├── GlobalOptions.spec.js.snap
│ │ │ ├── Header.spec.js.snap
│ │ │ ├── LoadingAnimation.spec.js.snap
│ │ │ ├── ResizableVegaLiteEmbed.spec.js.snap
│ │ │ ├── Sidebar.spec.js.snap
│ │ │ ├── SidebarFooter.spec.js.snap
│ │ │ ├── VizCard.spec.js.snap
│ │ │ └── VizEmpty.spec.js.snap
│ ├── infoIcon.svg
│ └── logo.png
├── generated
│ └── licenses.txt
├── index.css
├── index.js
├── registerServiceWorker.js
├── service-worker.js
├── setupTests.js
├── util
│ ├── Store.js
│ ├── __test__
│ │ ├── Store.spec.js
│ │ ├── __snapshots__
│ │ │ ├── Store.spec.js.snap
│ │ │ ├── urlState.spec.js.snap
│ │ │ └── util.spec.js.snap
│ │ ├── urlState.spec.js
│ │ └── util.spec.js
│ ├── constants.js
│ ├── selectStyles.js
│ ├── sparqlTypeToVegaType.js
│ ├── types.js
│ ├── urlState.js
│ ├── util.js
│ └── vega-lite-schema-v5.json
└── views
│ ├── App.js
│ ├── App.module.css
│ ├── AuthGate.js
│ └── StateRestorationGate.js
└── yarn.lock
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 | commands:
3 | cypress_tests:
4 | description: Setup and run cypress tests
5 | steps:
6 | - run:
7 | name: Run server for tests
8 | command: yarn http-server build/ -p 3500
9 | background: true
10 | - run:
11 | name: Cypress tests
12 | command: |
13 | yarn cypress install
14 | yarn cypress run
15 | - save_cache:
16 | key: v1-npm-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
17 | paths:
18 | - node_modules
19 | - ~/.cache/Cypress
20 | - store_artifacts:
21 | path: cypress/videos
22 | - store_artifacts:
23 | path: cypress/screenshots
24 | - store_test_results:
25 | path: cypress/junit-results
26 | jobs:
27 | build:
28 | docker:
29 | - image: cypress/base:latest
30 | environment:
31 | BASH_ENV: ~/.env
32 | CI: true
33 | steps:
34 | - checkout
35 | - restore_cache:
36 | keys:
37 | - v1-npm-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
38 | - v1-npm-deps-{{ .Branch }}
39 | - v1-npm-deps-
40 | - run: yarn install
41 | - run:
42 | name: Jest tests
43 | command: yarn test
44 | - run: yarn build
45 | - save_cache:
46 | key: v1-npm-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
47 | paths:
48 | - node_modules
49 | - cypress_tests
50 | build_main:
51 | docker:
52 | - image: cypress/base:latest
53 | environment:
54 | BASH_ENV: ~/.env
55 | steps:
56 | - checkout
57 | - restore_cache:
58 | keys:
59 | - v1-npm-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
60 | - v1-npm-deps-{{ .Branch }}
61 | - v1-npm-deps-
62 | - run: yarn install
63 | - run:
64 | name: Jest tests
65 | command: yarn test
66 | - run: yarn build
67 | - cypress_tests
68 | deploy_main:
69 | docker:
70 | - image: cimg/node:20.7.0
71 | environment:
72 | BASH_ENV: ~/.env
73 | steps:
74 | - checkout
75 | - run:
76 | name: Clone build-scripts repo
77 | command: git clone git@github.com:datadotworld/build-scripts.git
78 | - run:
79 | name: Setup aws creds
80 | command: build-scripts/cicd/setup_aws_credentials.sh
81 | - restore_cache:
82 | keys:
83 | - v1-npm-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
84 | - v1-npm-deps-{{ .Branch }}
85 | - v1-npm-deps-
86 | - run: yarn install
87 | - run:
88 | name: Generate license text
89 | command: yarn licenses generate-disclaimer --silent > src/generated/licenses.txt
90 | - run: yarn build
91 | - run:
92 | name: Install AWS Cli
93 | command: |
94 | cd /tmp
95 | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
96 | unzip awscliv2.zip
97 | ./aws/install -i ~/.local/aws-cli -b ~/.local/bin
98 | - run:
99 | name: Sync to s3
100 | command: |
101 | aws s3 sync build s3://dataworld-chartbuilder-us-east-1 --exclude "index.html" --exclude "manifest.json" --exclude "service-worker.js" --exclude "asset-manifest.json"
102 | aws s3 cp build/index.html s3://dataworld-chartbuilder-us-east-1/index.html --cache-control max-age=300
103 | aws s3 cp build/manifest.json s3://dataworld-chartbuilder-us-east-1/manifest.json --cache-control max-age=300
104 | aws s3 cp build/service-worker.js s3://dataworld-chartbuilder-us-east-1/service-worker.js --cache-control max-age=300
105 | aws s3 cp build/asset-manifest.json s3://dataworld-chartbuilder-us-east-1/asset-manifest.json --cache-control max-age=300
106 | environment:
107 | AWS_PROFILE: artifacts
108 | workflows:
109 | build:
110 | jobs:
111 | - build:
112 | filters:
113 | branches:
114 | ignore:
115 | - main
116 | build_and_deploy_main:
117 | jobs:
118 | - build_main:
119 | filters:
120 | branches:
121 | only:
122 | - main
123 | - deploy_main:
124 | requires:
125 | - build_main
126 | context:
127 | - aws-artifacts
128 | filters:
129 | branches:
130 | only:
131 | - main
132 |
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | PORT=3500
2 |
--------------------------------------------------------------------------------
/.env.development:
--------------------------------------------------------------------------------
1 | REACT_APP_CLIENT_ID=dw-chart-builder-dev
2 | REACT_APP_CLIENT_SECRET=zj1WfD8KUu6XYRlpvIbfc781auX8FseE
3 | REACT_APP_REDIRECT_URI=http://localhost:3500/
4 | REACT_APP_API_HOST=https://api.data.world
5 | REACT_APP_OAUTH_HOST=https://auth.data.world
6 |
--------------------------------------------------------------------------------
/.env.production:
--------------------------------------------------------------------------------
1 | REACT_APP_CLIENT_ID=dw-chart-builder
2 | REACT_APP_CLIENT_SECRET=xrIT33t4ElEs5qhlclKuy1bSsof30cys
3 | REACT_APP_REDIRECT_URI=https://chart-builder.data.world/
4 | REACT_APP_API_HOST=https://api.data.world
5 | REACT_APP_OAUTH_HOST=https://auth.data.world
6 |
--------------------------------------------------------------------------------
/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | .*/node_modules/cypress/.*
3 |
4 | [include]
5 |
6 | [libs]
7 |
8 | [lints]
9 | all=warn
10 | untyped-import=off
11 | unsafe-getters-setters=off
12 | unclear-type=off
13 |
14 | [options]
15 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
16 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
17 |
18 | [strict]
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .npmrc
3 | *.log
4 | /build
5 | .DS_Store
6 | .idea/
7 |
8 | cypress/videos/*
9 | cypress/screenshots/*
10 | cypress/junit-results/*
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2018 data.world, Inc.
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # chart-builder
2 |
3 | [](https://circleci.com/gh/datadotworld/chart-builder)
4 |
5 | This is an app to generate Vega-Lite visualizations using data from a data.world query.
6 |
7 | ### Getting started
8 |
9 | 1. Install dependencies: `yarn`
10 | 1. Start the server: `yarn start`
11 | 1. Navigate to: http://localhost:3500
12 |
13 | ### Building for production
14 |
15 | 1. `yarn build`
16 |
17 | ### Testing
18 |
19 | 1. Ensure the app is running on `:3500`
20 | 1. For jest tests: `yarn test`
21 | 1. For integration tests: `yarn cypress run`
22 |
23 | ### Adding tests
24 |
25 | 1. Ensure the app is running on `:3500`
26 | 1. For jest tests: `yarn test`
27 | 1. For integration tests: `yarn cypress open`
28 |
29 | ---
30 |
31 | This app was bootstrapped with `create-react-app`
32 |
--------------------------------------------------------------------------------
/cypress.config.js:
--------------------------------------------------------------------------------
1 | const { defineConfig } = require('cypress')
2 |
3 | module.exports = defineConfig({
4 | blockHosts: ['*.google-analytics.com', '*.mxpnl.com'],
5 |
6 | hosts: {
7 | 'api.data.world': '127.0.0.1'
8 | },
9 |
10 | reporter: 'junit',
11 |
12 | reporterOptions: {
13 | mochaFile: 'cypress/junit-results/my-test-output.xml',
14 | toConsole: true
15 | },
16 |
17 | e2e: {
18 | // We've imported your old cypress plugins here.
19 | // You may want to clean this up later by importing these.
20 | setupNodeEvents(on, config) {
21 | return require('./cypress/plugins/index.js')(on, config)
22 | },
23 | baseUrl: 'http://localhost:3500'
24 | },
25 |
26 | component: {
27 | devServer: {
28 | framework: 'create-react-app',
29 | bundler: 'webpack'
30 | }
31 | }
32 | })
33 |
--------------------------------------------------------------------------------
/cypress/e2e/spec.cy.js:
--------------------------------------------------------------------------------
1 | const fetchMock = require('fetch-mock')
2 |
3 | describe('Chart Builder', function() {
4 | let visitOptions
5 | beforeEach(function() {
6 | visitOptions = {
7 | onBeforeLoad: win => {
8 | let fetch = fetchMock.sandbox()
9 |
10 | // Mock the POST request with the correct endpoint and parameters
11 | fetch.post(
12 | `https://api.data.world/v0/sql/data-society/iris-species`,
13 | this.queryResponse
14 | )
15 |
16 | // Mock other requests
17 | fetch.get(`https://api.data.world/v0/user`, this.profile)
18 | fetch.post(
19 | `https://api.data.world/v0/insights/data-society/iris-species`,
20 | {
21 | message: 'Insight created successfully.',
22 | saving: false,
23 | uri: `https://api.data.world/data-society/iris-species/insights/abcd-1234`
24 | }
25 | )
26 | fetch.get(
27 | `https://api.data.world/v0/datasets/data-society/iris-species`,
28 | {
29 | accessLevel: 'WRITE',
30 | isProject: true
31 | }
32 | )
33 | fetch.put(
34 | `begin:https://api.data.world/v0/uploads/data-society/iris-species/files/test-title`,
35 | { message: 'File uploaded.' }
36 | )
37 | fetch.get('glob:*/static/media/licenses*', 'cypress license text')
38 |
39 | cy.stub(win, 'fetch', fetch).as('fetch')
40 | win.localStorage.setItem('token', 'foo')
41 | }
42 | }
43 |
44 | cy.once('uncaught:exception', () => false)
45 |
46 | cy.fixture('profile').as('profile')
47 | cy.fixture('queryResponse').as('queryResponse')
48 |
49 | cy.visit('/', visitOptions)
50 |
51 | // load example data
52 | cy.get('[data-test=example-link]').click()
53 |
54 | // set some chart options
55 | cy.get(
56 | '[data-test=encoding-container-0] > [data-test=encoding-bar]'
57 | ).click()
58 |
59 | cy.get('#react-select-4-option-1').click()
60 |
61 | cy.get('[data-test=encoding-container-1]> [data-test=encoding-bar]').click()
62 |
63 | cy.get('#react-select-6-option-2').click()
64 |
65 | cy.get('[data-test=chart-type-selector]').click()
66 |
67 | cy.get('#react-select-2-option-3').click()
68 | })
69 |
70 | it('Should toggle advanced options and ensure chart and title exist', function() {
71 | // toggle some advanced options
72 | cy.get('[data-test=encoding-container-0]').within(() => {
73 | cy.get('[data-test=toggle-adv-config]').click()
74 | cy.get('[data-test=bin-yes]').click()
75 | cy.get('[data-test=toggle-adv-config]').click()
76 | })
77 |
78 | cy.get('[data-test=encoding-container-1]').within(() => {
79 | cy.get('[data-test=toggle-adv-config]').click()
80 | cy.get('[data-test=zero-no]').click()
81 | cy.get('[data-test=toggle-adv-config]').click()
82 | })
83 |
84 | // add and remove encoding
85 | cy.get('[data-test=add-encoding]').click()
86 |
87 | cy.get(
88 | '[data-test=encoding-container-3]> [data-test=encoding-bar] > [data-test=toggle-adv-config]'
89 | ).click()
90 |
91 | cy.get('[data-test=rm-encoding]').click()
92 | cy.get(
93 | '[data-test=encoding-container-1] > [data-test=encoding-bar] > [data-test=toggle-adv-config]'
94 | )
95 | // check that titles work
96 | cy.get('[data-test=chart-title]').type('test title')
97 | cy.get('svg .role-title').contains('test title')
98 |
99 | // check that chart exists
100 | cy.get('[data-test=vega-embed]')
101 |
102 | cy.get('[data-test=license-open]').click()
103 | cy.get('[data-test=license-text]').contains('cypress license text')
104 | })
105 |
106 | it('Should be able to edit chart using editor', function() {
107 | cy.get('#configure-tabs-tab-editor').click()
108 |
109 | cy.get('.inputarea')
110 | .type('{rightarrow}')
111 | .type('"title": "test 123",')
112 |
113 | cy.get('#configure-tabs-tab-builder').click()
114 |
115 | cy.get('svg .role-title').contains('test 123')
116 | })
117 |
118 | it('Should be able to download a chart', function() {
119 | cy.get('#dropdown-download').click()
120 |
121 | // download as a vega-lite file format
122 | cy.get('[data-test=download-vega-lite]').trigger('mousedown')
123 | cy.get('[data-test=download-vega-lite]').should($m => {
124 | expect($m).to.have.length(1)
125 | expect($m.attr('href')).to.match(/^blob/)
126 | })
127 |
128 | // download as a vega file format
129 | cy.get('[data-test=download-vega]').trigger('mousedown')
130 | cy.get('[data-test=download-vega]').should($m => {
131 | expect($m).to.have.length(1)
132 | expect($m.attr('href')).to.match(/^blob/)
133 | })
134 |
135 | // download as a png file format
136 | cy.get('[data-test=download-png]').trigger('mousedown')
137 | cy.get('[data-test=download-png]').should($m => {
138 | expect($m).to.have.length(1)
139 | expect($m.attr('href')).to.match(/^data:image\/png/)
140 | })
141 |
142 | // download as a svg file format
143 | cy.get('[data-test=download-svg]').trigger('mousedown')
144 | cy.get('[data-test=download-svg]').should($m => {
145 | expect($m).to.have.length(1)
146 | expect($m.attr('href')).to.match(/^blob/)
147 | })
148 |
149 | // download as a HTML file format
150 | cy.get('[data-test=download-html]').trigger('mousedown')
151 | cy.get('[data-test=download-html]').should($m => {
152 | expect($m).to.have.length(1)
153 | expect($m.attr('href')).to.match(/^blob/)
154 | })
155 | })
156 |
157 | it('Should be able to be shared', function() {
158 | cy.get('[data-test=chart-title]').type('test title')
159 |
160 | // share as an insight
161 | cy.get('#dropdown-save-ddw').click()
162 | cy.get('[data-test=share-insight]').click()
163 | cy.get('.modal')
164 |
165 | cy.get('.btn-primary').click()
166 |
167 | cy.get('.alert-link').should(
168 | 'have.attr',
169 | 'href',
170 | 'https://data.world/data-society/iris-species/insights/abcd-1234'
171 | )
172 |
173 | cy.get('.modal-footer > .btn').click()
174 |
175 | // share as a file
176 | cy.get('#dropdown-save-ddw').click()
177 | cy.get('[data-test=share-file]').click()
178 | cy.get('.modal')
179 |
180 | cy.get('.btn-primary').click()
181 |
182 | cy.get('.alert-link').should(
183 | 'have.attr',
184 | 'href',
185 | 'https://data.world/data-society/iris-species/workspace/file?filename=test-title.vl.json'
186 | )
187 |
188 | cy.get('.modal-footer > .btn').click()
189 |
190 | // share as a markdown comment
191 | cy.get('#dropdown-save-ddw').click()
192 | cy.get('[data-test=share-markdown]').click()
193 | cy.get('.modal')
194 |
195 | cy.get('[data-test=share-markdown-embed] input').then($i => {
196 | expect($i.val()).to.have.string('test title')
197 | expect($i.val()).to.have.string('```')
198 | })
199 |
200 | cy.get('.modal-footer > .btn').click()
201 |
202 | // share as a URL
203 | cy.get('#dropdown-save-ddw').click()
204 | cy.get('[data-test=share-url]').click()
205 |
206 | cy.get('[data-test=share-url-text] input').then($i => {
207 | cy.visit($i.val(), visitOptions)
208 | })
209 | })
210 | })
211 |
--------------------------------------------------------------------------------
/cypress/fixtures/profile.json:
--------------------------------------------------------------------------------
1 | {
2 | "avatarUrl":
3 | "https://chart-builder.data.world/static/media/logo.ef710179.svg",
4 | "displayName": "Test User",
5 | "id": "testuser",
6 | "created": "2018-03-16T16:10:46.109Z",
7 | "updated": "2018-03-16T16:10:46.109Z"
8 | }
9 |
--------------------------------------------------------------------------------
/cypress/plugins/index.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example plugins/index.js can be used to load plugins
3 | //
4 | // You can change the location of this file or turn off loading
5 | // the plugins file with the 'pluginsFile' configuration option.
6 | //
7 | // You can read more here:
8 | // https://on.cypress.io/plugins-guide
9 | // ***********************************************************
10 |
11 | // This function is called when a project is opened or re-opened (e.g. due to
12 | // the project's config changing)
13 |
14 | module.exports = (on, config) => {
15 | // `on` is used to hook into various events Cypress emits
16 | // `config` is the resolved Cypress config
17 | }
18 |
--------------------------------------------------------------------------------
/cypress/support/commands.js:
--------------------------------------------------------------------------------
1 | // ***********************************************
2 | // This example commands.js shows you how to
3 | // create various custom commands and overwrite
4 | // existing commands.
5 | //
6 | // For more comprehensive examples of custom
7 | // commands please read more here:
8 | // https://on.cypress.io/custom-commands
9 | // ***********************************************
10 | //
11 | //
12 | // -- This is a parent command --
13 | // Cypress.Commands.add("login", (email, password) => { ... })
14 | //
15 | //
16 | // -- This is a child command --
17 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18 | //
19 | //
20 | // -- This is a dual command --
21 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22 | //
23 | //
24 | // -- This is will overwrite an existing command --
25 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
26 |
--------------------------------------------------------------------------------
/cypress/support/component-index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Components App
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/cypress/support/component.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example support/component.js is processed and
3 | // loaded automatically before your test files.
4 | //
5 | // This is a great place to put global configuration and
6 | // behavior that modifies Cypress.
7 | //
8 | // You can change the location of this file or turn off
9 | // automatically serving support files with the
10 | // 'supportFile' configuration option.
11 | //
12 | // You can read more here:
13 | // https://on.cypress.io/configuration
14 | // ***********************************************************
15 |
16 | // Import commands.js using ES2015 syntax:
17 | import './commands'
18 |
19 | // Alternatively you can use CommonJS syntax:
20 | // require('./commands')
21 |
22 | import { mount } from 'cypress/react'
23 |
24 | Cypress.Commands.add('mount', mount)
25 |
26 | // Example use:
27 | // cy.mount()
28 |
--------------------------------------------------------------------------------
/cypress/support/e2e.js:
--------------------------------------------------------------------------------
1 | // ***********************************************************
2 | // This example support/index.js is processed and
3 | // loaded automatically before your test files.
4 | //
5 | // This is a great place to put global configuration and
6 | // behavior that modifies Cypress.
7 | //
8 | // You can change the location of this file or turn off
9 | // automatically serving support files with the
10 | // 'supportFile' configuration option.
11 | //
12 | // You can read more here:
13 | // https://on.cypress.io/configuration
14 | // ***********************************************************
15 |
16 | // Import commands.js using ES2015 syntax:
17 | import './commands'
18 |
19 | // Alternatively you can use CommonJS syntax:
20 | // require('./commands')
21 |
--------------------------------------------------------------------------------
/docs/cb_Build Chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Build Chart.png
--------------------------------------------------------------------------------
/docs/cb_Chart Builder_Create Insight.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Chart Builder_Create Insight.gif
--------------------------------------------------------------------------------
/docs/cb_Chart Builder_Save and Share.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Chart Builder_Save and Share.gif
--------------------------------------------------------------------------------
/docs/cb_Chart Options_Left.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Chart Options_Left.gif
--------------------------------------------------------------------------------
/docs/cb_Name Your Chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Name Your Chart.png
--------------------------------------------------------------------------------
/docs/cb_Vega-Lite Editor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_Vega-Lite Editor.png
--------------------------------------------------------------------------------
/docs/cb_build-chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_build-chart.png
--------------------------------------------------------------------------------
/docs/cb_edit-chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_edit-chart.png
--------------------------------------------------------------------------------
/docs/cb_view-chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/cb_view-chart.png
--------------------------------------------------------------------------------
/docs/dw+cb_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/datadotworld/chart-builder/451bb761747f4516a7091c7fb2b1f80124193bc9/docs/dw+cb_light.png
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | data.world and Chart Builder
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
You've enabled Chart Builder, now what?
26 |
With Chart Builder by data.world, you can easily create embeddable vega-lite visualizations without having to write JSON code.
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
Start building a chart.
35 |
With the Build Chart button, you can quickly start building a chart right from your dataset:
36 |
37 |
Navigate to the dataset that you want to visualize with Chart Builder
38 |
39 |
Click the Build Chart button in the top right corner of the screen
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
Edit chart contents & settings.
54 |
You can easily edit your chart with the Visual Editor - simply choose your axes, point size, color, and any other encodings (fields) that you want. You can also further edit your choices by selecting “Options” next to each encoding.
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
Choose your chart type, set X & Y axes, and configure optional details like color and chart size.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | You can edit your chart directly using Vega-Lite by selecting the Vega-Lite Editor tab in your chart settings.
72 |
73 |
View your chart & add a title
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
What next?
90 |
Here are a few things you can do with Chart Builder and data.world:
91 |
92 |
Use the Save As option to save your chart as a file or an Insight to your project. Saving as an Insight allows viewers to see at-a-glance trends and information.
93 |
94 |
95 | Upload any vega (.vg.json) or vega-lite (.vl.json) file to your project to view and edit within data.world.
96 |
97 |
Embed your chart anywhere data.world supports markdown (like in comments), using the Share URL option from the Downloads menu.
98 |
99 | Use @[vega](link goes here) or @[vega-lite](link goes here) to embed your file.
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
Want to see more information on the data.world + Chart Builder Integration? check it out here.
109 |