Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 49103

Re: Custom Visualization additional DataViewCategoryColumn

$
0
0

hello Ignat,

 

Thanks for your help. I've been following up on your hint and somehow I understand that I may have a design flaw, so I was hoping you could help me review it and define the right approach.

 

I have a series of groups (field Category) for which I want to evaluate the distribution of the total sum of values(field Values) grouped by path (field Paths) for every category. (The pie slices/Arcs)

image.png

 

I need to be able to configure the color of the pie slices so they can be picked through the color Palette. 

 

But I also need to have a 3rd measure (Field Measure) to be shown in the middle of the pie chart, that depends from the field "Category" independently of "Paths" and "Values". It is usually a % hence I cannot aggregate randomly as sometimes will not be a dynamic DAX measure. (I'm OK forcing it to be though)

 

Before I was using unable to configure the color palette for the chart slice groups but everything else was working:

 

{

    "dataRoles": [{
            "displayName": "Category Data",
            "name": "Category",
            "kind": "Grouping"
        },
        {
            "displayName": "Paths",
            "name": "Paths",
            "kind": "Grouping",
            "description": "The value used to customize the shape of the data points",
            "requiredTypes": [{
                "text": true
            }]
        },
        {
            "displayName": "Values",
            "name": "Values",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": true
            }]
        },
        {
            "displayName": "Measure",
            "name": "measure",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": false
            }]
        },
        {
            "displayName": "Measure Color",
            "name": "measureColor",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": false
            }]
        }
    ],
    "dataViewMappings": [{
            "conditions": [{
                "Category": {
                    "min": 0,
                    "max": 3
                },
                "Paths": {
                    "min": 0,
                    "max": 1
                },
                "Values": {
                    "min": 0,
                    "max": 1
                },
                "Measure": {
                    "min": 0,
                    "max": 1
                }
            }],
            "categorical": {
                "categories": {
                    "for": {
                        "in": "Category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "group": {
                        "by": "Paths",
                        "select": [{
                            "bind": {
                                "to": "Values"
                            }
                        }],
                        "dataReductionAlgorithm": {
                            "top": {}
                        }
                    }
                }
            }
        },
        {
            "conditions": [{
                "Category": {
                    "min": 0,
                    "max": 3
                },
                "Paths": {
                    "min": 0,
                    "max": 1
                },
                "Values": {
                    "min": 0,
                    "max": 1
                },
                "Measure": {
                    "min": 0,
                    "max": 1
                }
            }],
            "categorical": {
                "categories": {
                    "for": {
                        "in": "Category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "select": [{
                            "bind": {
                                "to": "measure"
                            }
                        },
                        {
                            "bind": {
                                "to": "measureColor"
                            }
                        }
                    ]

                }
            }
        }
    ],
    "objects": {
        "colorSelector": {
            "displayName": "Data Colors",
            "properties": {
                "fill": {
                    "displayName": "Color",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        },
        "generalView": {
            "displayName": "General View",
            "properties": {
                "opacity": {
                    "displayName": "Bars Opacity",
                    "type": {
                        "integer": true
                    }
                },
                "showHelpLink": {
                    "displayName": "Show Help Button",
                    "type": {
                        "bool": true
                    }
                }
            }
        },
        "fontFamily": {
            "displayName": "Font",
            "properties": {
                "MarkerShape": {
                    "displayName": "Marker shape",
                    "type": {
                        "enumeration": [{
                                "displayName": "Default",
                                "description": "helvetica, arial, sans-serif",
                                "value": "helvetica, arial, sans-serif"
                            },
                            {
                                "displayName": "Arial",
                                "value": "Arial"
                            },
                            {
                                "displayName": "Arial Black",
                                "value": "\"Arial Black\""
                            }
                        ]
                    }
                }
            }
        }
    },
    "tooltips": {
        "supportedTypes": {
            "default": true,
            "canvas": true
        },
        "roles": [
            "Tooltips"
        ]
    }
}

Now after raising the question here, I've been working to build something different that I think would allow me to create selectors for the slices, but I cannot see how I can get the measure for the "Category" field.

 

{

    "dataRoles": [{
            "displayName": "Category Data",
            "name": "Category",
            "kind": "Grouping"
        },
        {
            "displayName": "Paths",
            "name": "Paths",
            "kind": "Grouping",
            "description": "The value used to customize the shape of the data points",
            "requiredTypes": [{
                "text": true
            }]
        },
        {
            "displayName": "Values",
            "name": "Values",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": true
            }]
        },
        {
            "displayName": "Measure",
            "name": "measure",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": false
            }]
        },
        {
            "displayName": "Measure Color",
            "name": "measureColor",
            "kind": "Measure",
            "requiredTypes": [{
                "numeric": true
            }, {
                "integer": false
            }]
        }
    ],
    "dataViewMappings": [{
            "conditions": [{
                "Category": {
                    "min": 0,
                    "max": 3
                },
                "Paths": {
                    "min": 0,
                    "max": 1
                },
                "Values": {
                    "min": 0,
                    "max": 1
                },
                "Measure": {
                    "min": 0,
                    "max": 1
                }
            }],
            "categorical": {
                "categories": {
                    "for": {
                        "in": "Category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                        "select": [{ 
                            "for": {
                                "in": "Values"
                            }},{
                            "bind": {
                                "to": "Paths"
                            }},{
                                "bind": {
                                    "to": "measure"
                                }
                            },
                            {
                                "bind": {
                                    "to": "measureColor"
                                }
                            }
                        ],
                        "dataReductionAlgorithm": {
                            "top": {}
                        }
                
                }
            }
        }
    ],
    "objects": {
        "colorSelector": {
            "displayName": "Data Colors",
            "properties": {
                "fill": {
                    "displayName": "Color",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        },
        "generalView": {
            "displayName": "General View",
            "properties": {
                "opacity": {
                    "displayName": "Bars Opacity",
                    "type": {
                        "integer": true
                    }
                },
                "showHelpLink": {
                    "displayName": "Show Help Button",
                    "type": {
                        "bool": true
                    }
                }
            }
        },
        "fontFamily": {
            "displayName": "Font",
            "properties": {
                "MarkerShape": {
                    "displayName": "Marker shape",
                    "type": {
                        "enumeration": [{
                                "displayName": "Default",
                                "description": "helvetica, arial, sans-serif",
                                "value": "helvetica, arial, sans-serif"
                            },
                            {
                                "displayName": "Arial",
                                "value": "Arial"
                            },
                            {
                                "displayName": "Arial Black",
                                "value": "\"Arial Black\""
                            }
                        ]
                    }
                }
            }
        }
    },
    "tooltips": {
        "supportedTypes": {
            "default": true,
            "canvas": true
        },
        "roles": [
            "Tooltips"
        ]
    }
}

 

 

Is it possible to group all the independent combinations of category-path in a single colorPalette setting and at the same time have a measure dependent on the category field?

 

Some help will be REALLY appreciated.

 

Thanks a lot in advance,

G.


Viewing all articles
Browse latest Browse all 49103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>