def creatDict(self): #insert other arguments 'Create a Json dictionary incorporating queried data and the Highcharts functions.' # organize 2-D list into a 1-D list #======================================================================= # orgDataIndex = 0 # for col in queriedData: # for row in queriedData: # this may be inverted order to organize by # organizedData[orgDataIndex].add(queriedData[row][col]) # orgDataIndex += 1 #======================================================================= # create chart object--set appropriate chart options using the Highcharts functions (ie add_data_set) based on what options were passed to QueriedData constructor chart = Highchart() chart.title(self.title) for row in self.queriedData: orgDataIndex = 0 for element in range(1, len(row)): # access individual elements of the list that is within the outer list (how the 2d list is build) # ^ skip first column because it has the name of the variable, not a value self.organizedData[orgDataIndex].append(element) orgDataIndex += 1 chart.add_data_set(self.organizedData, series_type=self.sType, name=self.queriedData[row][0]) # name is assumed to be in the 0th column of each row chart.set_options(EXAMPLE_CONFIG) # add further configs # current EXAMPLE_CONFIG provides default visual options; can be found in examples.py # Using chart.__export_options__(), create a Json dictionary (member variable) return chart.__export_options__() # return new json dictionary