Closed edras closed 4 years ago
@edras It seems that get_options
and get_dataset_options
are two different things. Would my review works for you?
Yes, you are right, get_options and get_dataset_options are different things.
Am Mi., 6. Mai 2020 um 05:46 Uhr schrieb Rémy HUBSCHER < notifications@github.com>:
@edras https://github.com/edras It seems that get_options and get_dataset_options are two different things. Would my review works for you?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/peopledoc/django-chartjs/pull/53#issuecomment-624520383, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD2IQR2QZIVVOUW3SQABE3RQEPXZANCNFSM4MZ2XAPA .
I made a modification on the BaseLineChartView class. Instead of using the class BaseLineOptionsChartView, I added the method get_options(self, index, color) to BaseLineChartView By this way, it is possible to insert new options per dataset preserving the default ones at the client View class. Example as in the Readme:
class LineChartJSONView(BaseLineChartView): def get_labels(self): """Return 7 labels for the x-axis.""" return ["January", "February", "March", "April", "May", "June", "July"]
If one uses the BaseLineOptionsChartView, it is necessary to modify the html template to: type: 'line', data: data.data, options: data.options,
Using as I suggested, it is not needed to modify the chart.html javascript anymore, keeping it as the README file: type: 'line', data: data,
With this suggestion, event the BaseLineOptionsChartView is not necessary anymore.
Regards