Home

Doughnut Chart Code

You only need this lines in order to see the Doughnut chart.

<head>
    <title>My A-Frame Scene</title>
    <script src="https://aframe.io/releases/1.4.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-charts-component/dist/aframe-charts-component.min.js"></script>
</head>
<body>
    <!-- Aframe scene -->
    <a-scene background="color: grey">
        <!-- Aframe light -->
        <a-light type="point" intensity="1" position="-2 10 10"></a-light>

        <!-- Declaring chart component -->
        <a-entity charts="type: pie; dataPoints: ../data/dataPie.json; pie_radius: 3; pie_doughnut: true"></a-entity>

        <!-- Aframe camera -->
        <a-entity position="1 18 18" rotation="-30 15 0">
            <a-camera>
                <a-cursor></a-cursor>
            </a-camera>
        </a-entity>
    </a-scene>
</body>
Check the visual example See our API for more options

JSON input example

            
[
  {"size": 1, "color": "#ff0000"},
  {"size": 1, "color": "#00ff00"},
  {"size": 2, "color": "#0000ff"},
  {"size": 1.5, "color": "#000000"},
  {"size": 4, "color": "#4CC3D9"}
]