0

I want to create a chart with both points and lines, as in the image below.

enter image description here

I have tried multichart with type: 'line' + 'barchart', and it seems to work. But when I specify 'scatter' + 'line' no scatter data shows up.

Is it possible to do this with Angular nvd3?

Thanks a lot for your help.

Here is my plunker code:

var app = angular.module('plunker', ['nvd3']);

app.controller('MainCtrl', function($scope) {
 $scope.options = {
    chart: {
        type: 'multiChart',
        height: 450,
        margin : {
            top: 30,
            right: 60,
            bottom: 50,
            left: 70
        },
        color: d3.scale.category10().range(),
        //useInteractiveGuideline: true,
        transitionDuration: 500,
        xAxis: {
            tickFormat: function(d){
                return d3.format(',f')(d);
            }
        },
        yAxis: {
            tickFormat: function(d){
                return d3.format('.02f')(d);
            }
        }
    }
};    

$scope.data = [
    {
        key: 'X',
        type: 'scatter',
        values: [
            { x: 1, y: 125, size: Math.random(), shape: 'circle' },
            { x: 2, y: 125, size: Math.random(), shape: 'circle' },
            { x: 3, y: 140, size: Math.random(), shape: 'circle' }
        ],
        yAxis: 1
    },
    {
        key: 'Y',
        type: 'bar',
        values: [
            {x:1, y:109, label:'C2.1'},
            {x:2, y:102, label:'C2.2'},
            {x:3, y:105, label:'C2.3'}
        ],
        yAxis: 1
    },
    {
        key: 'Z',
        type: 'line',
        values: [
            { x: 1, y: 115 },
            { x: 2, y: 120 },
            { x: 3, y: 130 }
        ],
        yAxis: 1
    }
];
});
user494491
  • 21
  • 4

1 Answers1

0

your code is correct, may be the version you were using of Angular-nvd3 si not correct here is a working plunker

Mohamed NAOUALI
  • 2,092
  • 1
  • 23
  • 29