Skip to content
Permalink
Browse files
fix category error and remove np dependency
  • Loading branch information
ghtmtt authored and m-kuhn committed Apr 12, 2017
1 parent 9c2f88c commit 0c5b667986c2b8f31c2f909d4a8f05b91b61313f
Showing with 5 additions and 5 deletions.
  1. +5 −5 python/plugins/processing/algs/qgis/BarPlot.py
@@ -27,7 +27,6 @@

import plotly as plt
import plotly.graph_objs as go
import numpy as np

from qgis.core import (QgsApplication)
from processing.core.parameters import ParameterTable
@@ -65,7 +64,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterTableField(self.NAME_FIELD,
self.tr('Category name field'),
self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER))
ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterTableField(self.VALUE_FIELD,
self.tr('Value field'),
self.INPUT,
@@ -81,9 +80,10 @@ def processAlgorithm(self, feedback):

output = self.getOutputValue(self.OUTPUT)

values = vector.values(layer, namefieldname, valuefieldname)
values = vector.values(layer, valuefieldname)

x_var = [i[namefieldname] for i in layer.getFeatures()]

ind = np.arange(len(values[namefieldname]))
data = [go.Bar(x=ind,
data = [go.Bar(x=x_var,
y=values[valuefieldname])]
plt.offline.plot(data, filename=output, auto_open=False)

0 comments on commit 0c5b667

Please sign in to comment.