Skip to content

Commit

Permalink
Add BYOC demo
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickCrabbe committed Dec 11, 2024
1 parent bc3e7a8 commit a49702b
Show file tree
Hide file tree
Showing 23 changed files with 6,193 additions and 30 deletions.
24 changes: 24 additions & 0 deletions bring-your-own-chart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
37 changes: 37 additions & 0 deletions bring-your-own-chart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Bring your own chart"
description: "Create your own custom visualization powered by Luzmo queries, with full interactivity to other Luzmo charts."
tags:
- chart
- flex
author: "Luzmo"
image: "https://s3.eu-west-1.amazonaws.com/static.cumul.io/showcases/byoc.png"
url: "https://stackblitz.com/edit/vitejs-vite-fob7ft?embed=1&view=preview"
---

# Luzmo Flex showcase: Bring Your Own Chart
The chart on the left is a standard donut chart, created using [Luzmo Flex](https://www.luzmo.com/flex). On the right, you see a fully custom bar chart visualization, developed in React. The bar chart's data is dynamically populated by querying Luzmo datasets through the Luzmo API [`data` endpoint](https://developer.luzmo.com/api/getData).

Maintaining bi-directional interactivity between these charts is seamless. For example, clicking a slice in the donut chart automatically filters the data displayed in the custom bar chart. This functionality is achieved by utilizing the `changedFilters` Flex [event](https://developer.luzmo.com/guide/flex--component-api-reference#event-changedfilters).

## Installation

To install and run the application, follow these steps:

1. Install the dependencies using npm:

```bash
npm install
```

## Running the Application

1. Start the application using `npm`:

```bash
npm dev
```

## Accessing the Application

Once the application is running, you can access it in your web browser at `http://localhost:5173`.
26 changes: 26 additions & 0 deletions bring-your-own-chart/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config({
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
ignores: ['dist'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
})
13 changes: 13 additions & 0 deletions bring-your-own-chart/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit a49702b

Please sign in to comment.