PlotlyAndDataView results not populating

I’m looking for some help populating a PlotlyAndDataView result.

Using the documentaiton for datagroup and DataResult ( SDK Reference - Views | VIKTOR Documentation, , SDK Reference - Views | VIKTOR Documentation ), I try the following code:


        group = vkt.DataGroup(
            vkt.DataItem('a', 1),
            vkt.DataItem('b', 2),
            output_c=vkt.DataItem('c', 3),  # 'output_c' can be used in the entity summary
            output_d=vkt.DataItem('d', 4),  # 'output_d' can be used in the entity summary
        )

        result = vkt.DataResult(group)

        return vkt.PlotlyAndDataResult(fig.to_json(), result)

However, I end up receiving an error. Any idea why that might be?

Hi Christian,

The PlotlyAndDataResult expects a DataGroup object, so you would need to update your code like this:

        result = vkt.DataGroup(
            vkt.DataItem('a', 1),
            vkt.DataItem('b', 2),
            output_c=vkt.DataItem('c', 3),  # 'output_c' can be used in the entity summary
            output_d=vkt.DataItem('d', 4),  # 'output_d' can be used in the entity summary
        )

        return vkt.PlotlyAndDataResult(fig.to_json(), result)
1 Like