Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar Chart - Error: Mandatory attribute chart.x is missing on chart #65

Open
Muhan95 opened this issue May 17, 2017 · 1 comment
Open

Comments

@Muhan95
Copy link

Muhan95 commented May 17, 2017

Hi guys,

I'm trying to render the barChart via angular-dc and I'm running into the following issue:

Error: Mandatory attribute chart.x is missing on chart

I'm using the same rundimension and grouping from the pieChart example:

$scope.runDimension = ndx.dimension(function(d) {return "run-"+d.Run;}) $scope.speedSumGroup = $scope.runDimension.group().reduceSum(function(d) {return d.Speed * d.Run;});

I've also tried to manually set the "dc-x" attribute and I have also tried to override the data within the angular-dc.js script to no avail.

I've seen someone on stackoverflow use the following with success:
<div dc-chart="barChart" dc-width="990" dc-height="180" dc-x="volumeScale" dc-x-units="d3.time.months" dc-dimension="ticketVolumeDim" dc-group="ticketVolumeGroup" dc-gap="4" class="dc-chart" dc-margins="{top: 0, right: 50, bottom: 20, left: 40}" dc-gap="1" dc-ordinal-colors="ordinalColors" dc-centerBar="true"> </div>

Can you tell me which of the above I have to include to get the bar chart to render - and if possible some of the value formats.

My pieCharts work perfectly. Can you guys let me know what I should be doing differently?

Any help is appreciated and I'd be willing to contribute my fixed version (along with the other charts I plan to work on) as angular-dc examples.

Thanks

@TomNeyland @webmaven @tardyp

@tomsaleeba
Copy link

I had the same problem and I've fixed it on my fork: https://github.com/tomsaleeba/angular-dc/tree/patch-2

The source of your problem might be different but I was using a fork that had updated deps including lodash v4. The new version had breaking changes from v3 (hence, the new major version) but the _.extend() call on arrays wasn't concatenating them together, instead it just replaced items in the first array with those from the second. The line I fixed for that was https://github.com/tomsaleeba/angular-dc/blob/patch-2/src/angular-dc.js#L104. There were a few other fixes too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants