Skip to content

highcharts formatter #59

Description

@flavio-pm

Hello! I'm sorry if this isn't the place to ask, but I wanted to know if chartit supports passing formatter javascript functions to the chart, and if so, how to do so.

I have a two-level donut chart that retrieves data from the database, where each data object carries two distinct numeric values. I'm charting them together on the donut's outer layer with their total in the inner layer, but there's a lot of 0 values clustering at the top of the outer chart (which may, by the way, mean I'm not doing the drilldown right.) Since each zero value may be paired with a non zero value in their data objects, I can't straight up exclude them from the queryset. Google says to use a formatter function in HighCharts that checks the value and returns it only if it's greater than 0:

dataLabels: { formatter:function() { if(this.y != 0) { return this.y; } } }

Problem is, attempting to pass such a function as is conflicts with Python interpretation, and passing it as a string seems to erase the whole chart.

So, yeah, is there a way to pass functions as of now? And if not, can you guys help me figure out what to do?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions