<?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 Problem with Selection in custom visualization in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/112461#M3908</link>
    <description>&lt;P&gt;I am developing&amp;nbsp;custom Visual in typescript and want to make dropdown having respected data in it.&lt;/P&gt;&lt;P&gt;Ok with Visual Creation, But having problem to implement Selection ID with the data append to my visual.Whenever i use selection ID with data, then my visual fails to load data in it. Please help me with this , regarding selection in custom visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code in Visual.ts file is given below:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    //Array to store URL
    interface imageViewModel {
        
        URL: imageDataPoint[];
      
    };
    //Declare URL as string
    interface imageDataPoint {
        imageUrl: string;
        selectionId: ISelectionId;

        
        
    };
    //Data from Power BI to imageViewModel    
    function visualTransform(options: VisualUpdateOptions, host: IVisualHost): imageViewModel {
                let dataViews = options.dataViews;
                let viewModel: imageViewModel = {
                                                    URL: []
                                                    
                                                 };
       if (!dataViews
           || !dataViews[0]
           || !dataViews[0].categorical
           || !dataViews[0].categorical.categories
           || !dataViews[0].categorical.categories[0].values)
                    return viewModel;
                let imageData = dataViews[0].categorical;
                if (imageData) {
                    var imageElement = imageData.categories;
           

           if (imageElement &amp;amp;&amp;amp; imageElement.length &amp;gt; 0) {

               for (var i = 0, catLength = imageElement.length; i &amp;lt; catLength; i++) {
                   var k = 0;

                   viewModel.URL.push({
                       imageUrl: &amp;lt;string&amp;gt;imageElement[0].values[i],
                       selectionId: host.createSelectionIdBuilder()
                           .withMeasure(imageElement[0].values[i])
                           .createSelectionId()
                      })
                  

               }
               
               
           }
       }
    

       return viewModel;
    }
    export class Visual implements IVisual {
        
        private image: d3.Selection&amp;lt;SVGElement&amp;gt;;
          
        private host: IVisualHost;        
        private selectionManager: ISelectionManager;
        
                   
       

        static Config = {
            xScalePadding: 0.1,
            solidOpacity: 1,
            transparentOpacity: 0.5
         };
       
        //Element initialization
        constructor(options: VisualConstructorOptions) {
            

            this.image = d3.select(options.element).append("select");
                               
        }

        //Any change tu visualization executes this upadate function
        public update(options: VisualUpdateOptions)  {
            
            let selectionManager = this.selectionManager;
            let viewModel: imageViewModel = visualTransform(options, this.host);
                       
            var zoomFlag = 0;
           
            let divPop = this.image.selectAll('option').data(viewModel.URL);

            divPop.enter().append('option').text(function (d) { return d.imageUrl; });

            
            divPop.exit().remove();
                     
            
            
         
        }
        
       
        public destroy(): void {
            //TODO: Perform any cleanup tasks here
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2017 10:43:57 GMT</pubDate>
    <dc:creator>as7</dc:creator>
    <dc:date>2017-01-12T10:43:57Z</dc:date>
    <item>
      <title>Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/112461#M3908</link>
      <description>&lt;P&gt;I am developing&amp;nbsp;custom Visual in typescript and want to make dropdown having respected data in it.&lt;/P&gt;&lt;P&gt;Ok with Visual Creation, But having problem to implement Selection ID with the data append to my visual.Whenever i use selection ID with data, then my visual fails to load data in it. Please help me with this , regarding selection in custom visual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code in Visual.ts file is given below:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    //Array to store URL
    interface imageViewModel {
        
        URL: imageDataPoint[];
      
    };
    //Declare URL as string
    interface imageDataPoint {
        imageUrl: string;
        selectionId: ISelectionId;

        
        
    };
    //Data from Power BI to imageViewModel    
    function visualTransform(options: VisualUpdateOptions, host: IVisualHost): imageViewModel {
                let dataViews = options.dataViews;
                let viewModel: imageViewModel = {
                                                    URL: []
                                                    
                                                 };
       if (!dataViews
           || !dataViews[0]
           || !dataViews[0].categorical
           || !dataViews[0].categorical.categories
           || !dataViews[0].categorical.categories[0].values)
                    return viewModel;
                let imageData = dataViews[0].categorical;
                if (imageData) {
                    var imageElement = imageData.categories;
           

           if (imageElement &amp;amp;&amp;amp; imageElement.length &amp;gt; 0) {

               for (var i = 0, catLength = imageElement.length; i &amp;lt; catLength; i++) {
                   var k = 0;

                   viewModel.URL.push({
                       imageUrl: &amp;lt;string&amp;gt;imageElement[0].values[i],
                       selectionId: host.createSelectionIdBuilder()
                           .withMeasure(imageElement[0].values[i])
                           .createSelectionId()
                      })
                  

               }
               
               
           }
       }
    

       return viewModel;
    }
    export class Visual implements IVisual {
        
        private image: d3.Selection&amp;lt;SVGElement&amp;gt;;
          
        private host: IVisualHost;        
        private selectionManager: ISelectionManager;
        
                   
       

        static Config = {
            xScalePadding: 0.1,
            solidOpacity: 1,
            transparentOpacity: 0.5
         };
       
        //Element initialization
        constructor(options: VisualConstructorOptions) {
            

            this.image = d3.select(options.element).append("select");
                               
        }

        //Any change tu visualization executes this upadate function
        public update(options: VisualUpdateOptions)  {
            
            let selectionManager = this.selectionManager;
            let viewModel: imageViewModel = visualTransform(options, this.host);
                       
            var zoomFlag = 0;
           
            let divPop = this.image.selectAll('option').data(viewModel.URL);

            divPop.enter().append('option').text(function (d) { return d.imageUrl; });

            
            divPop.exit().remove();
                     
            
            
         
        }
        
       
        public destroy(): void {
            //TODO: Perform any cleanup tasks here
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 10:43:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/112461#M3908</guid>
      <dc:creator>as7</dc:creator>
      <dc:date>2017-01-12T10:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/114453#M3949</link>
      <description>&lt;P&gt;What is the purpose for dropdowning? What does the visual do actually&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 10:06:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/114453#M3949</guid>
      <dc:creator>KumarDarmesh</dc:creator>
      <dc:date>2017-01-17T10:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/114463#M3952</link>
      <description>&lt;P&gt;I want visual to have start time and end time inputs . that's why i thinking of having drop down in both , so that it contain 01,02,03 hrs and so on. So, when user select start time 01 hrs and end time 02 hrs , then data filter according to this time period.&lt;/P&gt;&lt;P&gt;and if any visual available in power BI for this type of need then please tell me, otherwise please help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 10:17:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/114463#M3952</guid>
      <dc:creator>as7</dc:creator>
      <dc:date>2017-01-17T10:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123042#M4248</link>
      <description>&lt;P&gt;Why not creating a calendar table in hours and slicer the hours then?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 05:48:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123042#M4248</guid>
      <dc:creator>KumarDarmesh</dc:creator>
      <dc:date>2017-02-06T05:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123049#M4249</link>
      <description>&lt;P&gt;Thanks for your suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create calendar table in hours as i have created calendar table for date purpose but how can i put time in it and bifurcate it to hours. It will be very helpful if you can show the DAX for it. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 06:19:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123049#M4249</guid>
      <dc:creator>as7</dc:creator>
      <dc:date>2017-02-06T06:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123097#M4250</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/10278"&gt;@as7&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You can try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;calendar table in hours =
SELECTCOLUMNS (
    ADDCOLUMNS (
        CROSSJOIN (
            CALENDAR ( "2016-01-01", "2017-12-31" ),
            SELECTCOLUMNS (
                ADDCOLUMNS ( CALENDAR ( "2016-01-01", "2016-01-24" ), "DAY", DAY ( [Date] ) ),
                "DAY", [DAY]
            )
        ),
        "dateTime", [Date]
            + IF ( [DAY] = 24, 0, [DAY] )
                / 24
    ),
    "Date", [Date],
    "dateTime", [dateTime]
)
&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Feb 2017 08:38:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123097#M4250</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-02-06T08:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123181#M4258</link>
      <description>&lt;P&gt;thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, my requirement is to have a time slicer that can slice my data from one time to other time . and power BI dosen't have such time slicer.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2017 12:11:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/123181#M4258</guid>
      <dc:creator>as7</dc:creator>
      <dc:date>2017-02-06T12:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/124151#M4284</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/10278"&gt;@as7&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Do you want to slice a time window like '02:00' to '15:00'&amp;nbsp;for all days? If so, there's some workaround by creating proper lookup tables and measures.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check a similar thread &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/Specify-custom-date-periods-with-predefined-date-periods/m-p/122256#M51694" target="_self"&gt;Specify custom date periods with predefined date periods&lt;/A&gt;. The difference is, you have to create start time and end time and filter the data with them, rather than start date and end date in that link.&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;</description>
      <pubDate>Wed, 08 Feb 2017 07:27:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/124151#M4284</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-02-08T07:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Selection in custom visualization</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/124241#M4286</link>
      <description>&lt;P&gt;Thanks for this help. But can you please tell me how can i make a table with range of time only not date.&lt;/P&gt;&lt;P&gt;Because Calendar() function is taking date only.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 09:16:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Problem-with-Selection-in-custom-visualization/m-p/124241#M4286</guid>
      <dc:creator>as7</dc:creator>
      <dc:date>2017-02-08T09:16:16Z</dc:date>
    </item>
  </channel>
</rss>

