Skip to content

Commit

Permalink
fix category error and remove np dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ghtmtt authored and m-kuhn committed Apr 12, 2017
1 parent 9c2f88c commit 0c5b667
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/BarPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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.