{"id":20893428,"url":"https://github.com/arction/lcjs-example-0460-simplefunnelchart","last_synced_at":"2025-03-12T19:14:33.119Z","repository":{"id":98723643,"uuid":"200631711","full_name":"Arction/lcjs-example-0460-simpleFunnelChart","owner":"Arction","description":"A demo application showcasing LightningChart JS Funnel chart.","archived":false,"fork":false,"pushed_at":"2025-02-05T11:37:34.000Z","size":10905,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-05T12:31:50.466Z","etag":null,"topics":["demo","example","funnel-chart","javascript","lcjs","lightningchart-js","performance","visualization","webgl"],"latest_commit_sha":null,"homepage":"https://www.arction.com/lightningchart-js-interactive-examples/examples/lcjs-example-0460-simpleFunnelChart.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Arction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-05T10:11:39.000Z","updated_at":"2025-02-05T11:35:56.000Z","dependencies_parsed_at":"2025-02-05T12:28:35.934Z","dependency_job_id":"2725841c-5652-4575-b513-e782f6697812","html_url":"https://github.com/Arction/lcjs-example-0460-simpleFunnelChart","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arction%2Flcjs-example-0460-simpleFunnelChart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arction%2Flcjs-example-0460-simpleFunnelChart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arction%2Flcjs-example-0460-simpleFunnelChart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arction%2Flcjs-example-0460-simpleFunnelChart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arction","download_url":"https://codeload.github.com/Arction/lcjs-example-0460-simpleFunnelChart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243277498,"owners_count":20265352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","example","funnel-chart","javascript","lcjs","lightningchart-js","performance","visualization","webgl"],"created_at":"2024-11-18T10:15:47.553Z","updated_at":"2025-03-12T19:14:33.102Z","avatar_url":"https://github.com/Arction.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript Funnel Chart\n\n![JavaScript Funnel Chart](simpleFunnel-darkGold.png)\n\nThis demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript.\r\n\r\nLightningChart JS is entirely GPU accelerated and performance optimized charting library for presenting massive amounts of data. It offers an easy way of creating sophisticated and interactive charts and adding them to your website or web application.\r\n\r\nThe demo can be used as an example or a seed project. Local execution requires the following steps:\r\n\r\n-   Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed\r\n-   Open the project folder in a terminal:\r\n\r\n          npm install              # fetches dependencies\r\n          npm start                # builds an application and starts the development server\r\n\r\n-   The application is available at _http://localhost:8080_ in your browser, webpack-dev-server provides hot reload functionality.\r\n\n\n## Description\n\nFunnel Chart is a chart used to show statistical graphic. Funnel Chart is divided into slices, with each slice illustrating the numerical portion of the Funnel. Each slice's size is proportional to its quantity.\r\n\r\nThe chart can be created with a simple line of code.\r\n\r\n```javascript\r\n// Create a new Funnel Chart.\r\nconst funnel = lightningChart().Funnel()\r\n```\r\n\r\nThe Funnel has two types for displaying the labels for each slice; The slices can be placed either on top of each slice or the labels can be placed to the side of the Funnel, drawn with a connector line between the slice and its label.\r\n\r\nIf no type is given, the Funnel defaults to showing labels on side of Funnel.\r\n\r\n```javascript\r\n// Create a Funnel Chart with labels on the side.\r\nconst funnel = lightningChart().Funnel({ type: FunnelChartTypes.LabelsOnSide })\r\n\r\n// Create a Funnel Chart with labels inside of slices.\r\nconst funnel = lightningChart().Funnel({\r\n    type: FunnelChartTypes.LabelsInsideSlices,\r\n})\r\n```\r\n\r\nAfter creating the Funnel Chart, we can populate it by adding slices to it.\r\nThe slice should always get a name and value as parameters.\r\n\r\nYou can alternatively add multiple slices as an array of objects containing a name and a value for each slice.\r\n\r\n```javascript\r\n// Add a single slice to the Funnel.\r\nfunnel.addSlice('Slice', 50)\r\n\r\n// Add multiple slices to populate the Funnel.\r\nconst data = [\r\n    {\r\n        name: 'Prospects',\r\n        value: 2000,\r\n    },\r\n    {\r\n        name: 'Contacts',\r\n        value: 1540,\r\n    },\r\n    {\r\n        name: 'Leads',\r\n        value: 1095,\r\n    },\r\n    {\r\n        name: 'Customers',\r\n        value: 549,\r\n    },\r\n]\r\n// Add data to the slices\r\nfunnel.addSlices(data)\r\n```\r\n\r\nModifying how the Funnel and its slices are drawn can be done through the Funnel Chart's API.\r\n\r\n```javascript\r\n// Set the gap between each of the slices. This value can be between 0 to 20 pixels.\r\nfunnel.setSliceGap(5)\r\n\r\n// Set the width of the Funnel's top edge. This value can be from 0 to 100 (in percents).\r\nfunnel.setHeadWidth(95)\r\n\r\n// Set the width of the Funnel's bottom edge. This value can be from 0 to 100 (in percents).\r\nfunnel.setNeckWidth(40)\r\n\r\n// If the labels are set to be placed on the side of the Funnel,\r\n// we can determine the side they will be placed.\r\nfunnel.setLabelSide(FunnelLabelSide.Right)\r\n```\r\n\r\nThe slices can be styled using the Funnel Chart's API.\r\n\r\n```javascript\r\n// Create a palette of Fill Styles to use with the Funnel's Slices.\r\nconst palette = SolidFillPalette(ColorPalettes.warm, data.length)\r\n// Set the palette used for coloring each of the slices.\r\nfunnel.setSliceFillStyle(palette)\r\n```\r\n\r\nThe Funnel Chart has different ways to draw the slices depending on their value.\r\n\r\nPerhaps the most common way is to show the value as the height of the slice in relation to the combined value of all slices.\r\nThis can be achieved by setting the Funnel's Slice Mode to Variable Height.\r\n\r\n```javascript\r\n// Set Funnel chart slice mode to Variable Height.\r\nfunnel.setSliceMode(FunnelSliceModes.VariableHeight)\r\n```\r\n\r\nAnother common way is to show all the slices with equal height, but to have their width change depending on their value relative to the combined total value.\r\n\r\n```javascript\r\n// Set Funnel Chart slice mode to Variable Width.\r\nfunnel.setSliceMode(FunnelSliceModes.VariableWidth)\r\n```\r\n\r\nThe labels for all slices can be formatted in different ways.\r\n\r\n```javascript\r\n// Set the label formatting to show the slice's name and value.\r\nfunnel.setLabelFormatter(SliceLabelFormatters.NamePlusValue)\r\n```\r\n\r\nThe lines connecting each slice to its label can be modified.\r\n\r\n```javascript\r\n// Set the style that will be used with each connector line.\r\nfunnel.setLabelConnectorStyle(\r\n    new SolidLine({\r\n        thickness: 2,\r\n        fillStyle: new SolidFill({ color: ColorRGBA(125, 95, 220) }),\r\n    }),\r\n)\r\n```\r\n\n\n## API Links\n\n* [Funnel Chart]\n* [Collection of Funnel Chart implementations]\n* [Options for selecting side of labels]\n* [Collection of modes for Funnel Slices]\n* [s label implementations]\n* [Collection of default color palletes]\n* [Solid FillStyle]\n* [Solid Line]\n\n\n## Support\n\nIf you notice an error in the example code, please open an issue on [GitHub][0] repository of the entire example.\r\n\r\nOfficial [API documentation][1] can be found on [LightningChart][2] website.\r\n\r\nIf the docs and other materials do not solve your problem as well as implementation help is needed, ask on [StackOverflow][3] (tagged lightningchart).\r\n\r\nIf you think you found a bug in the LightningChart JavaScript library, please contact sales@lightningchart.com.\r\n\r\nDirect developer email support can be purchased through a [Support Plan][4] or by contacting sales@lightningchart.com.\r\n\r\n[0]: https://github.com/Arction/\r\n[1]: https://lightningchart.com/lightningchart-js-api-documentation/\r\n[2]: https://lightningchart.com\r\n[3]: https://stackoverflow.com/questions/tagged/lightningchart\r\n[4]: https://lightningchart.com/support-services/\r\n\n© LightningChart Ltd 2009-2022. All rights reserved.\r\n\n\n[Funnel Chart]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/classes/FunnelChart.html\n[Collection of Funnel Chart implementations]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/variables/FunnelChartTypes-1.html\n[Options for selecting side of labels]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/enums/FunnelLabelSide.html\n[Collection of modes for Funnel Slices]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/enums/FunnelSliceModes.html\n[s label implementations]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/variables/SliceLabelFormatters.html\n[Collection of default color palletes]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/variables/ColorPalettes.html\n[Solid FillStyle]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/classes/SolidFill.html\n[Solid Line]: https://lightningchart.com/js-charts/api-documentation/v7.0.1/classes/SolidLine.html\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farction%2Flcjs-example-0460-simplefunnelchart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farction%2Flcjs-example-0460-simplefunnelchart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farction%2Flcjs-example-0460-simplefunnelchart/lists"}