Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zingchart setseriesdata visibility issue

Pretty straight forward question, as soon as i use setseries data the visibility my pie chart is no longer visible. I have checked the plot object and the series were updated correctly, however since I do not find a visibility attribute anywhere in the plot object, i am at a loss. The lack of zingcharts documentation and proper examples does not aid either. Im fairly certain this is a simple scenario to solve, but I've been unable to do so.

zingchart.exec('organismplot', 'setseriesdata', {
        "data": [
            {
                 "values":data_update.organisms,
                 "text":"active",
                 "background-color":"#2d4962",
                 "border-width":"1px",
                 "shadow":0,
                 "visible":1
            },
            {
                  "values":(data_update.totalorganism-data_update.organisms),
                  "text":"passive",
                  "background-color":"#2d4962",
                  "border-width":"1px",
                  "shadow":0,
                  "visible":0
        }]
like image 576
Alejandro Avatar asked Aug 25 '26 16:08

Alejandro


1 Answers

I'm a member of the ZingChart team, and I'm happy to help you out!

What is the type of data_update.organisms and data_update.totalorganism-data_update.organisms? Make sure that you are passing a single element array, or if those are simply single values, wrap the variables in brackets to create a single value array for the "values" attribute. E.G.:

"data": [
        {
             "values":[data_update.organisms], // If data_update.organisms is a single value.
             "text":"active",
             "background-color":"#2d4962",
             "border-width":"1px",
             "shadow":0,
             "visible":1
        },
        {
              "values":[data_update.totalorganism-data_update.organisms], // Again, single value array.
              "text":"passive",
              "background-color":"#2d4962",
              "border-width":"1px",
              "shadow":0,
              "visible":0
        }
]

I've created a demo using your exact method call, except I've changed the "values" attributes to use a single value array, which are needed for pie charts. Check out the demo here.

I hope that helps. Let me know if you need some more help!

like image 114
Stalfos Avatar answered Aug 31 '26 06:08

Stalfos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!