ma-serial-chart 3.3.0 Uncaught TypeError
-
@jared-wiltshire said in ma-serial-chart 3.3.0 Uncaught TypeError:
This should not be necessary and is probably the source of your woes:
AmCharts.charts[AmCharts.charts.length-1].validateData();Yes I added that yesterday after noticing that I could change between 1 and 2 weeks and the chart would not update unless I forced it... I'll apply your suggestion, as we can all tell, I'm far from competent with Angular.. I'm learning a lot though,
-
NO luck, it works for a while then throws a tizzy. The other thing that happens which is bizarre is the style applied for a given width is slightly out. I'll go for the last day, then go to last week. the columns are set to the width as if it were a last day setting. same if I go from a week to a fortnight, then back again. Hope that makes a sense.
So it looks like i'm not passing some necessary info to tell the chart what size the columns should be...
I swear I'm starting to go slightly crazy here. I can console log the components. I can see the data being pushed out. the chart then goes yep, yep, yep, oh on second thought something's broken. can't tell you why. crunch...Wonder if I should see about trying to get the unminified serial chart if it exists to debug further...
-
@MattFox it seems like the serial chart component is not detecting changes to your data, the chart component watches for changes in the values and redraws the chart. After the chart is redrawn it finds column graphs and sets their column width manually, I believe this code was added to work around a bug in amCharts.
Are you using both the
values="xyz"
attribute and also aseries-x-values="xyz"
attribute by any chance? It could also be something to do with your functions which are modifying the arrays of point values. -
no, am just using series-x-values and their respective series-x-point attributes. I'm half inclined to agree that it could be to do with modifying the point values to match for cumulative day counts of the first hourly values. I'm running out of ideas on how to do this with the tools I have. I wonder if I should just manually create an AmCharts instance and populate it with javascript functions rather than using the directive. Who knows...
I'll get there somehow.. -
Looking at it now, I get the feeling it throws a wobbly because I'm pulling the same datapoint twice to try and have a point for daily and a point for hourly...
-
Have given up and reverted to the 3.2.4 serial chart in the overrides folder. Multiple column charts disappear so have had to use line chart for hourly and column for daily data.
-
@mattfox said in ma-serial-chart 3.3.0 Uncaught TypeError:
Multiple column charts disappear
Looking into this now, I've had other reports too,
-
Thanks Jared, greatly appreciated. Happy to test and assist in debugging for you as required if needed
Fox
-
I'll have a UI module release out this afternoon which should fix the column chart bug. Also completely reverted the change that caused the
Uncaught TypeError: Cannot read property 'graphs' of undefined
bug so you can see if its any better in that regard too. -
I take my hat off to you.
Will happily check and test for you.Fox
-
@MattFox UI module v3.3.1 is out which contains the fixes I mentioned.
-
Finally got around to updating and testing. Have installed the latest modules (3.3.4).
And.. unless I look in hourly/minute timeframes:
All of my columns are needles.
I've not got a clue where to look so I can fix this. Can't go backwards in versions because it causes one of the charts to disappear unless I reload the page when I zoom in or toggle the legends. So other than this little proverbial pain in the chart works great!Thanks all!
Fox -
Hi Jared, got any suggestions???
-
Nvm, found it!
var columnGraphs = event.chart.graphs.filter(function(graph) { return graph.type === 'column' && graph.ownColumns; }); var redrawNeeded = false; columnGraphs.forEach(function(graph) { var newWidth = Math.floor(graph.width / graph.ownColumns.length * 0.8); if (chart.categoryAxis.equalSpacing) { newWidth = undefined; } if (newWidth !== graph.fixedColumnWidth) { graph.fixedColumnWidth = newWidth; redrawNeeded = true; } }); if (redrawNeeded){ chart.validateNow(); }