Fix chartdataAction()'s complexity