• Resolved tangobango

    (@tangobango)


    Hi.

    I’m wanting to set an attribute to a value that there is no direct shortcode parameter for: vAxis.minValue. I see chart_v_axis, so I need to qualify it further, somehow.

    Drawing from another answer you gave, you offered:

    You probably want chart_h_axis=”{slantedText: true}”, since there is no hAxis.slantedText attribute for shortcodes.

    I tried

    chart_v_axis='{"minValue": 0}'
    chart_v_axis='{"minValue": "0"}'
    chart_v_axis='{minValue: 0}'
    chart_v_axis="{minValue: 0}"

    The first two just don’t work. The last two give errors.

    On this page, the bottom graph uses the first one above, which seems to be the most likely solution to me. Minimum v axis is -40, not 0, as desired.

    https://test.edkatzman.com/index.php/2017/01/13/line-graph/

    What’s the correct syntax for these dot properties?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Meitar

    (@meitar)

    The first is the correct syntax:

    chart_v_axis='{"minValue": 0}'

    Dot-notation on the Google documentation just indicates a key for an object. The plugin uses shortcode attributes to define which objects those JSON-encoded values get added to. So chart_v_axis gets translated to vAxis, and vAxis.minValue is the JavaScript way of saying “a vAxis object with a key whose name is minValue.” In JavaScript, that would look like this:

    var vAxis_object = { minValue: 0 }

    So, in JSON, it should be:

    {"minValue": 0}

    which is exactly what you wrote the first time.

    All the shortcode’s attribute (chart_v_axis) does is make an object behind the scenes for you. That’s how it’s supposed to work, anyway. If it’s not working as expected, share the shortcode you’re using so I can try it out myself.

    Thread Starter tangobango

    (@tangobango)

    Hi.

    It’s not working as expected. The minimum is not being used.

    Here’s the shortcode:

    [gdoc key="https://docs.google.com/spreadsheets/d/1BZsqE-CRGtX2MSDgfzPUWikcVm0PQr8gWgDUrxRDhtw/edit?usp=sharing" chart="Line" query="select A, B" chart_curve_type="function" title="My Test Data" chart_legend='{"position": "bottom"}' chart_v_axis='{"minValue": 0}']

    Webpage is at https://test.edkatzman.com/index.php/2017/01/13/line-graph/ where it’s the bottom graph

    Thanks.

    Thread Starter tangobango

    (@tangobango)

    Hi.

    Forget about this one. I’m pretty sure it’s caused by a default Charts behavior related to the axis, not the short code. I’m getting other similar constructs to work fine.

    Thanks for all your help.

    • This reply was modified 8 years, 2 months ago by tangobango.
    Plugin Author Meitar

    (@meitar)

    ?? Cool.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Handling the dot notation from Charts API’ is closed to new replies.