score:9
this snippet is an example of the treemap module for chart.js.
also here are more examples and the documentation.
var toptags = [
{tag:'python',num:133269},{tag:'javascript',num:109742},{tag:'java',num:65490},{tag:'c#',num:45445},{tag:'html',num:43767},{tag:'android',num:42657},{tag:'reactjs',num:38844},{tag:'php',num:34381},{tag:'sql',num:29996},{tag:'python',num:29942},{tag:'css',num:29654},{tag:'r',num:28319},{tag:'c++',num:27389},{tag:'node.js',num:25415},{tag:'angular',num:24093},{tag:'pandas',num:23826},{tag:'arrays',num:23075},{tag:'jquery',num:18968},{tag:'mysql',num:18863},{tag:'swift',num:17971},{tag:'ios',num:17600},{tag:'json',num:15589},{tag:'laravel',num:15537},{tag:'flutter',num:15201},{tag:'c',num:15195},{tag:'django',num:14748},{tag:'sql',num:12752},{tag:'reactjs',num:10974},{tag:'excel',num:10962},{tag:'list',num:10726},{tag:'regex',num:10676}
];
var canvas = document.getelementbyid("treemap");
var ctx = canvas.getcontext("2d");
var chart = window.chart = new chart(ctx, {
type: "treemap",
data: {
datasets: [{
tree: toptags,
key: "num",
groups: ['tag'],
spacing: 0.5,
borderwidth: 1.5,
fontcolor: "black",
bordercolor: "grey"
}]
},
options: {
maintainaspectratio: false,
legend: { display: false },
tooltips: { enabled: false }
}
});
body { margin: 0; overflow: hidden; }
canvas { width: 100vw; height: 100vh; }
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-treemap@0.2.3"></script>
<canvas id="treemap"></canvas>
Source: stackoverflow.com
Related Query
- Chartjs treemap example
- How to add ChartJS code in Html2Pdf to view image
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Run Chartjs Dart example
- Chartjs not working with d3 from csv source
- Vue and Chartjs - Running a simple example of vue-chartjs
- ChartJS have xAxes labels match data source
- Updating Chartjs to 2.5 with custom code
- Calling data from outside of Chartjs code
- VueJS + Chartjs - Chart only renders after code change
- ChartJS 2.0 differences in code help needed
- My Chartjs is not updating after setstate full code attached Reactjs Update
- Chartjs doc examples are lightning fast but same code is slow when reproducing
- 'require is not defined' error when attempting to use chartjs in javascript code
- How to run Chart.js samples using source code
- Code for Chartjs Typescript definition file
- ChartJs doesn't work on a local downloaded page of Circular Gauge chart example
- Chart.js Example Code not working
- Dynamically update values of a chartjs chart
- Different color for each bar in a bar chart; ChartJS
- Hide points in ChartJS LineGraph
- ChartJS Line Charts - remove color underneath lines
- Skip decimal points on y-axis in chartJS
- How to set ChartJS Y axis title?
- Chartjs Bar Chart showing old data when hovering
- Chartjs change grid line color
- Chart area background color chartjs
- Custom Legend with ChartJS v2.0
- Chartjs Tooltip Line Breaks
- Is it possible in chartjs to hide certain dataset legends?
More Query from same tag
- rotated partial doughnut chart with a point marker in chart.js agularJS
- How do I implement the 'autoskip' feature in chartjs?
- Integrate Blazor with Chart.js: how to pass an object
- How to draw the X-axis (line at Y = 0) in Chart.js?
- How to reduce the number of points shown on line chartjs chart with a large dataset?
- ChartJS: Draw vertical line at data point on chart on mouseover
- How can I add shadow color below the line in chart.js charts?
- Pass variable from function js to other function js
- How to set static value in y-axis in chart.js?
- ChartJs 3.x: ResizeObserver is not a constructor
- Vuejs - Chartjs - turning a doughnut chart to a gauge - rotation
- Adding different point style to each column from parsed csv in chart.js
- How to display label inside pie chart in Chartkick?
- How to create a stacked graph using ChartJS
- Charts.js Pie Chart
- findOne returns undefined in onRendered
- Chart.js time object labels not updating correctly
- Chart.js - Increase spacing between bottom legend and chart
- How to create rounded bars for Bar Chart.js v2?
- ChartJS vertical line not removed on touchend
- Chart.js hidden property
- Create data structure in c# for multiple series charts
- Chart.js how to create chart wirhout y-axis for two data sets
- How i can refresh chart without refresh page?
- Convert a dynamic piechart from CanvasJS to Google Charts?
- How to make ng2-Chart Scrollable for large amount of data sets?
- How do I prevent Chartjs tooltip callback returning multiple instances of the same value?
- ChartJS Doughnout Chart Pie Offset on Hover
- Using map reduce in javascript
- ChartJS Recreate Chart