<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I get the data? in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85518#M3024</link>
    <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/16172"&gt;@vkokorin﻿&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well that's it! You can see the function is invoked.&lt;/P&gt;&lt;PRE&gt;        public update(options: VisualUpdateOptions) {
            let viewModel: BarChartViewModel = visualTransform(options, this.host);&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Nov 2016 10:10:21 GMT</pubDate>
    <dc:creator>v-chuncz-msft</dc:creator>
    <dc:date>2016-11-03T10:10:21Z</dc:date>
    <item>
      <title>How can I get the data?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/84066#M2970</link>
      <description>&lt;P&gt;Hello, guys. Help me, please. I have this default code in file visual.ts:&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {

    export class Visual implements IVisual {
        private target: HTMLElement;
        private updateCount: number;

        constructor(options: VisualConstructorOptions) {
            console.log('Visual constructor', options);
            this.target = options.element;
            this.updateCount = 0;
        }

        public update(options: VisualUpdateOptions) {
            console.log('Visual update', options);
            this.target.innerHTML = `&amp;lt;p&amp;gt;Update count: &amp;lt;em&amp;gt;${(this.updateCount++)}&amp;lt;/em&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;br&amp;gt;`;
        }
    }
    
}&lt;/PRE&gt;&lt;P&gt;And this default code in file capabilities.json:&lt;/P&gt;&lt;PRE&gt;{
    "dataRoles": [
        {
            "displayName": "Category Data",
            "name": "category",
            "kind": "Grouping"
        },
        {
            "displayName": "Measure Data",
            "name": "measure",
            "kind": "Measure"
        }
    ],
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {
                        "in": "category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "measure"
                            }
                        }
                    ]
                }
            }
        }
    ]
}&lt;/PRE&gt;&lt;P&gt;What I have to do to get any data in visualization? I need just get the data.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 07:56:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/84066#M2970</guid>
      <dc:creator>vkokorin</dc:creator>
      <dc:date>2016-10-31T07:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the data?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85082#M3002</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/16172"&gt;@vkokorin﻿&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on my research, you will need to fill the update method by defining your own visualTransform function that&amp;nbsp;will allow you to convert DataView into a view model your visual will use.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 11:32:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85082#M3002</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2016-11-02T11:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the data?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85143#M3005</link>
      <description>&lt;P&gt;You mean something like this?&lt;/P&gt;&lt;PRE&gt;    function visualTransform(options: VisualUpdateOptions, host: IVisualHost): BarChartViewModel {
        let dataViews = options.dataViews;
        let defaultSettings: BarChartSettings = {
            enableAxis: {
                show: false,
            }
        };
        let viewModel: BarChartViewModel = {
            dataPoints: [],
            dataMax: 0,
            settings: &amp;lt;BarChartSettings&amp;gt;{}
        }; 

        if (!dataViews
            || !dataViews[0]
            || !dataViews[0].categorical
            || !dataViews[0].categorical.categories
            || !dataViews[0].categorical.categories[0].source
            || !dataViews[0].categorical.values)
            return viewModel;

        let categorical = dataViews[0].categorical;
        let category = categorical.categories[0];
        let dataValue = categorical.values[0];

        let barChartDataPoints: BarChartDataPoint[] = [];
        let dataMax: number;

        let colorPalette: IColorPalette = host.colorPalette;
        let objects = dataViews[0].metadata.objects;
        let barChartSettings: BarChartSettings = {
            enableAxis: {
                show: getValue&amp;lt;boolean&amp;gt;(objects, 'enableAxis', 'show', defaultSettings.enableAxis.show),
            }
        }
        for (let i = 0, len = Math.max(category.values.length, dataValue.values.length); i &amp;lt; len; i++) {
            let defaultColor: Fill = {
                solid: {
                    color: colorPalette.getColor(category.values[i] + '').value
                }
            }

            barChartDataPoints.push({
                category: category.values[i] + '',
                value: dataValue.values[i],
                color: getCategoricalObjectValue&amp;lt;Fill&amp;gt;(category, i, 'colorSelector', 'fill', defaultColor).solid.color,
                selectionId: host.createSelectionIdBuilder()
                    .withCategory(category, i)
                    .createSelectionId()
            });
        }
        dataMax = &amp;lt;number&amp;gt;dataValue.maxLocal;

        return {
            dataPoints: barChartDataPoints,
            dataMax: dataMax,
            settings: barChartSettings,
        };
    }&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2016 13:53:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85143#M3005</guid>
      <dc:creator>vkokorin</dc:creator>
      <dc:date>2016-11-02T13:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the data?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85518#M3024</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/16172"&gt;@vkokorin﻿&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well that's it! You can see the function is invoked.&lt;/P&gt;&lt;PRE&gt;        public update(options: VisualUpdateOptions) {
            let viewModel: BarChartViewModel = visualTransform(options, this.host);&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Nov 2016 10:10:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-can-I-get-the-data/m-p/85518#M3024</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2016-11-03T10:10:21Z</dc:date>
    </item>
  </channel>
</rss>

