Radial Pie

Pie having its section radius depend on a measure

main
run-button
run-button
reset-button
    const DataModel = muze.DataModel;
    const calculateVariable = DataModel.Operators.calculateVariable;

    let rootData = new DataModel(data, schema);

    let DMWithCount = calculateVariable({
        name: 'CountVehicle',
        type: 'measure',
        defAggFn: 'count',
        numberFormat: val => parseInt(val, 10)
    }, ['Name', () => 1])(rootData);

    let env = muze();
    let canvas = env.canvas();

    canvas = canvas
        .rows([])
        .columns([])
        .config({
          axes: {
            radius: {
              range: (range) => {
                return [range[0] + 50, range[1]];
              }
            }
          }
        })
        .layers([{ 
          	mark: 'arc',
          	encoding: {
				radius: 'CountVehicle',
  				angle: 'Maker'
            }
        }])
        .data(DMWithCount)
		.width(500)
		.height(400)
        .color('Cylinders') // Color the slices with sylinders
        .title('Radial pie chart', { position: 'top', align: 'center' })
        .subtitle('Variation of radial chart which encodes Maker and Count of cars for a particular maker', { position: 'top', align: 'center' })
        .mount('#chart-container');