<?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: Create stacked column chart in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/289054#M8491</link>
    <description>&lt;P&gt;yes, all done with small issues with clearing legend (legendLine), corrected it.&lt;BR /&gt;But because of "grouped()", how i understand, sorting broken. So i can't correct sort data in bars DESC and legends ASC (because legends "grouped()" and their indexes ) and sort(function(a,b) {return d3.ascending(a.source.groupName+'', b.source.groupName+'');} not working. Or may be i dont correct use "sort". Please, how i can sort bars and legends from up to down (and in bars and in legends) on display&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sort.jpg" style="width: 599px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/66223i0967FDF1DF78A9C8/image-size/large?v=v2&amp;amp;px=999" role="button" title="sort.jpg" alt="sort.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2017 14:35:59 GMT</pubDate>
    <dc:creator>ShutTap</dc:creator>
    <dc:date>2017-10-24T14:35:59Z</dc:date>
    <item>
      <title>Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/256598#M7911</link>
      <description>&lt;P&gt;Hi. How to add "Legend" and use it in visualisation? Please help, with some examples of declaring and using, or with link on learning documentation&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 13:44:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/256598#M7911</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-21T13:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/256600#M7912</link>
      <description>&lt;P&gt;"legend" i mean legend as labels and legend as stack&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 13:47:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/256600#M7912</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-21T13:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/257115#M7935</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/42583"&gt;@ShutTap&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You might take a look at &lt;A href="https://github.com/Microsoft/powerbi-visuals-utils-chartutils/blob/master/src/legend/legend.ts#L29" target="_blank"&gt;powerbi-visuals-utils-chartutils&lt;/A&gt;&amp;nbsp;that support legend.&lt;/P&gt;&lt;P&gt;You might also take a look at &lt;A href="https://github.com/Microsoft/PowerBI-visuals-Tornado/blob/master/src/tornadoChart.ts#L545" target="_blank"&gt;Tornado Chart &lt;/A&gt;that uses this module.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 07:37:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/257115#M7935</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-09-22T07:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/257364#M7945</link>
      <description>&lt;P&gt;Thanks, very helpful&lt;BR /&gt;One more question: which analogue of&amp;nbsp;getCategoricalObjectValue but for Values (in "legend"), it's needed to add default color to groups of legend, that repeated from category to category&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;getCategoricalObjectValue&amp;lt;Fill&amp;gt;(category, k, 'colorSelector', 'fill', defaultColor)&lt;/PRE&gt;&lt;P&gt;but fo legends value.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Legends" src="https://ip1.i.lithium.com/b98a96ef03f339bc4c4b93559199758d4fdc1ad4/687474703a2f2f733031392e726164696b616c2e72752f693632322f313730392f39642f3966653365333337666334642e6a7067" border="0" /&gt;&lt;/P&gt;&lt;P&gt;it's named "series", ok...&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 07:30:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/257364#M7945</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-25T07:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/258346#M7973</link>
      <description>&lt;P&gt;You might get a default color for each category by using &lt;A href="https://github.com/Microsoft/PowerBI-visuals-tools/blob/master/templates/visuals/.api/v1.7.0/PowerBI-visuals.d.ts#L1282" target="_blank"&gt;colorPalette.getColor&lt;/A&gt; method.&lt;/P&gt;&lt;P&gt;Please take a look at &lt;A href="https://github.com/Microsoft/PowerBI-visuals/blob/master/Tutorial/ColorPalette.md#assigning-color-to-data-points" target="_blank"&gt;this example&lt;/A&gt; to find out more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 09:31:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/258346#M7973</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-09-25T09:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/258462#M7978</link>
      <description>&lt;P&gt;Thanks, great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 13:11:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/258462#M7978</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-25T13:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/259303#M8005</link>
      <description>&lt;P&gt;One more question.&lt;/P&gt;&lt;P&gt;I take color from colorPallete, display colors of legends (series) in Editor, but i&amp;nbsp;don't know how associate it. To edit colors from Editor&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 12:04:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/259303#M8005</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-26T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/259998#M8023</link>
      <description>&lt;P&gt;You should follow these steps below to assign colors for fromatting panel:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Specify a property that has color options (&lt;A href="https://github.com/Microsoft/powerbi-visuals-sankey/blob/master/capabilities.json#L180" target="_self"&gt;example&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;Parse color for each category (&lt;A href="https://github.com/Microsoft/powerbi-visuals-sankey/blob/master/src/visual.ts#L664" target="_blank"&gt;example&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;Create a instance of SelectionId for category. Selection id is used for binding a color to a proper category (&lt;A href="https://github.com/Microsoft/powerbi-visuals-sankey/blob/master/src/visual.ts#L669" target="_blank"&gt;example&lt;/A&gt;)&lt;/LI&gt;&lt;LI&gt;Enumerate colors (&lt;A href="https://github.com/Microsoft/powerbi-visuals-sankey/blob/master/src/visual.ts#L1751" target="_blank"&gt;example&lt;/A&gt;)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if you have extra questions.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 10:01:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/259998#M8023</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-09-27T10:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260139#M8026</link>
      <description>&lt;P&gt;Thank you very much! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;When visualisation updates i clear old data with&amp;nbsp;.exit().remove(); but it not working. What i doing wrong?&lt;BR /&gt;Also i try to package project to PowerBI Desktop, it exports without errors, but in PBI Desctop clear white plane without any data. What it can be?&lt;BR /&gt;P.S. There is no official documentation?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2017 14:27:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260139#M8026</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-27T14:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260792#M8039</link>
      <description>&lt;P&gt;Can you post a piece of code that clears old data?&lt;/P&gt;&lt;P&gt;Does your visual work in Power BI web? Are there any exceptions?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 09:55:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260792#M8039</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-09-28T09:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260882#M8043</link>
      <description>&lt;P&gt;In PowerBI web is working correctly, exception - no clearing old data.&lt;BR /&gt;For example:&lt;/P&gt;&lt;PRE&gt;let barsSeries = this.barContainer.selectAll('dev').data(viewModel.dataPoints);
			barsSeries.enter().append('rect').classed('bar', true).attr({
				width: xScale.rangeBand(),
				height: d =&amp;gt; height - yScale(&amp;lt;number&amp;gt;d.value),
				x: d =&amp;gt; xScale(d.category)+margins.left,
				y: d =&amp;gt; yScale(&amp;lt;number&amp;gt;d.sumHeight)+margins.top,
				fill: d =&amp;gt; d.color,
				'fill-opacity': viewModel.settings.generalView.opacity / 100
			});&lt;/PRE&gt;&lt;P&gt;and clear it&lt;/P&gt;&lt;PRE&gt;barsSeries.exit().remove();&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Sep 2017 12:48:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/260882#M8043</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-09-28T12:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/261395#M8053</link>
      <description>&lt;P&gt;This code looks well for me but I have a couple of questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Are you sure that&amp;nbsp;viewModel.dataPoints and&amp;nbsp;viewModel.settings.generalView.opacity are always defined?&lt;/LI&gt;&lt;LI&gt;Can you share entire source code to investigate this issue deeper?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 06:57:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/261395#M8053</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-09-29T06:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/263210#M8089</link>
      <description>&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";
	
	interface VisualViewModel {
		dataPoints: VisualDataPoint[];
		dataLegends: VisualDataLegend[];
		dataMax: number;
		settings: VisualSettings;
	};
	
	interface VisualDataPoint {
		category: string;
		valueName: string;
		value: PrimitiveValue;
		sumHeight: PrimitiveValue;
		conventions: string;
		color: string;
		selectionId: powerbi.visuals.ISelectionId;
	};
	
	interface VisualDataLegend {
		valueName: string;
		index: PrimitiveValue;
		conventions: string;
		color: string;
		selectionId: powerbi.visuals.ISelectionId;
	};
	
	interface VisualSettings {
		enableAxis: {
			show: boolean;
		};

		generalView: {
			opacity: number;
		};
		
		legend: {
			show: boolean;
		};
		/*
		colorSelector: {
			defaultColor: string[];
		};*/
	}
	
	
	function visualTransform(options: VisualUpdateOptions, host: IVisualHost): VisualViewModel {
		let dataViews = options.dataViews;
		let defaultSettings: VisualSettings = {
			enableAxis: {
				show: false
			},
			generalView: {
				opacity: 100
			},
			legend: {
				show: true
			}/*,
			colorSelector: {
				defaultColor: []
			}*/
		};
		let viewModel: VisualViewModel = {
			dataPoints: [],
			dataLegends: [],
			dataMax: 0,
			settings: &amp;lt;VisualSettings&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;
		
		let VisualDataPoints: VisualDataPoint[] = [];
		let VisualDataLegends: VisualDataLegend[] = [];
		let dataMax: number;

		let colorPalette: IColorPalette = host.colorPalette;
		let objects = dataViews[0].metadata.objects;
		let VisualSettings: VisualSettings = {
			enableAxis: {
				show: getValue&amp;lt;boolean&amp;gt;(objects, 'enableAxis', 'show', defaultSettings.enableAxis.show),
			},
			generalView: {
				opacity: getValue&amp;lt;number&amp;gt;(objects, 'generalView', 'opacity', defaultSettings.generalView.opacity),
			},
			legend: {
				show: getValue&amp;lt;boolean&amp;gt;(objects, 'legend', 'show', defaultSettings.legend.show),
			}/*,
			colorSelector: {
				defaultColor: []
			}*/
		};
		
		
		dataValue.sort(function(a,b) {return d3.ascending(a.source.groupName+'', b.source.groupName+'');});
		
		for (let k = 0; k &amp;lt; dataValue.length; k++) {
			
			//VisualSettings.colorSelector.defaultColor[k] = colorPalette.getColor(dataValue[k].source.groupName + '').value;

			VisualDataLegends.push({
				valueName: dataValue[k].source.groupName + '',
				index: k,
				conventions: 'dataValue[k].source.groupName',
				color: colorPalette.getColor(dataValue[k].source.groupName+'').value,
				selectionId: host.createSelectionIdBuilder().withMeasure(dataValue[k].source.groupName+'').createSelectionId()
			});
		}
		
		dataMax=0;
		dataValue.sort(function(a,b) {return d3.descending(a.source.groupName+'', b.source.groupName+'');});
		
		for (let i = 0; i &amp;lt; category.values.length; i++) {
			let sumHeight=0;
			for (let k = 0; k &amp;lt; dataValue.length; k++) {
				
				sumHeight += &amp;lt;number&amp;gt;dataValue[k].values[i];

				VisualDataPoints.push({
					category: category.values[i] + '',
					valueName: dataValue[k].source.groupName + '',
					value: dataValue[k].values[i],
					sumHeight: sumHeight,
					conventions: 'dataValue[k].source.groupName',
					color: colorPalette.getColor(dataValue[k].source.groupName+'').value,
					selectionId: host.createSelectionIdBuilder().withMeasure(dataValue[k].source.groupName+'').createSelectionId()
				});
			}
		dataMax = sumHeight &amp;gt; dataMax ? sumHeight : dataMax;
		}
		
		return {
			dataPoints: VisualDataPoints,
			dataLegends: VisualDataLegends,
			dataMax: dataMax,
			settings: VisualSettings,
		};
	}
	
	
    export class Visual implements IVisual {
		private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private host: IVisualHost;
		private selectionManager: ISelectionManager;
		private VisualContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private barContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private xAxis: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private labelDataLegends: VisualDataLegend[];
		private VisualSettings: VisualSettings;
		private tooltipServiceWrapper: ITooltipServiceWrapper;
		private locale: string;
		private title: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private legend: d3.Selection&amp;lt;SVGElement&amp;gt;;

		static Config = {
			xScalePadding: 0.2,
			solidOpacity: 1,
			transparentOpacity: 0.5,
			margins: {
				top: 30,
				right: 160,
				bottom: 30,
				left: 0,
			},
			xAxisFontMultiplier: 0.04,
		};
		
		
		constructor(options: VisualConstructorOptions) {
			this.host = options.host;
			this.selectionManager = options.host.createSelectionManager();
			this.tooltipServiceWrapper = createTooltipServiceWrapper(this.host.tooltipService, options.element);
			let svg = this.svg = d3.select(options.element).append('svg').classed('Visual', true);
			this.locale = options.host.locale;
			this.barContainer = svg.append('g').classed('barContainer', true);
			this.xAxis = svg.append('g').classed('xAxis', true);
			this.title = svg.append("g").classed("textLabel", true);
			this.legend = svg.append("g").classed("legend", true);
		}

        public update(options: VisualUpdateOptions, title: string) {
			let viewModel: VisualViewModel = visualTransform(options, this.host);
			let settings = this.VisualSettings = viewModel.settings;
			this.labelDataLegends = viewModel.dataLegends;

			let width = options.viewport.width;
			let height = options.viewport.height;
			let margins = Visual.Config.margins;
			
			this.svg.attr({
				width: width,
				height: height
			});
			
			if (settings.enableAxis.show) { height -= margins.bottom; }
			if (settings.legend.show) { width -= margins.right; }
			height -= margins.top;
			width -= margins.left;
			
			this.xAxis.style({
				'font-size': d3.min([height, width]) * Visual.Config.xAxisFontMultiplier,
			});

			let yScale = d3.scale.linear()
				.domain([0, viewModel.dataMax])
				.range([height, 0]);
			let xScale = d3.scale.ordinal()
				.domain(viewModel.dataPoints.map(d =&amp;gt; d.category))
				.rangeRoundBands([0, width], Visual.Config.xScalePadding, 0.2);

			let xAxis = d3.svg.axis()
				.scale(xScale)
				.orient('bottom');

			this.xAxis.attr('transform', 'translate('+margins.left+', ' + (height+margins.top) + ')')
				.call(xAxis);
			
			// This must be an anonymous function instead of a lambda because
			// d3 uses 'this' as the reference to the element that was clicked.
			let selectionManager = this.selectionManager;
			let allowInteractions = this.host.allowInteractions;
			
			let legend = this.legend.selectAll('dev').data(viewModel.dataLegends);
			
			//bars (with series)
			let barsSeries = this.barContainer.selectAll('dev').data(viewModel.dataPoints);
			barsSeries.enter().append('rect').classed('bar', true).attr({
				width: xScale.rangeBand(),
				height: d =&amp;gt; height - yScale(&amp;lt;number&amp;gt;d.value),
				x: d =&amp;gt; xScale(d.category)+margins.left,
				y: d =&amp;gt; yScale(&amp;lt;number&amp;gt;d.sumHeight)+margins.top,
				fill: d =&amp;gt; d.color,
				'fill-opacity': viewModel.settings.generalView.opacity / 100
			});
			
			//console.log(viewModel.dataPoints);
			
			barsSeries.on('click', function(d) {
				// Allow selection only if the visual is rendered in a view that supports interactivity (e.g. Report)
				if (allowInteractions) {
					selectionManager.select(d.selectionId).then((ids: ISelectionId[]) =&amp;gt; {
						barsSeries.attr({
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});

						d3.select(this).attr({
							'fill-opacity': Visual.Config.solidOpacity
						});
						
						if (settings.legend.show) {
							legend.attr({
								'fill-opacity': Visual.Config.solidOpacity
							});
						}
					});
					(&amp;lt;Event&amp;gt;d3.event).stopPropagation();
				}
			});
			
			
			//Legends
			if (settings.legend.show) {
				
			legend.enter().append('circle').classed('legendPoint', true).attr({
				r: 4,
				cx: width+margins.right-8,
				cy: d =&amp;gt; &amp;lt;number&amp;gt;d.index * 14+margins.top-4,
				fill: d =&amp;gt; d.color
			});
			
			legend.enter().append('text').classed('legend', true).attr({
				x: width+margins.right-20,
				y: d =&amp;gt; &amp;lt;number&amp;gt;d.index * 14+margins.top,
				'font-size': 12,
				fill: d =&amp;gt; '#777',
				'text-anchor': 'end'
			}).text(d =&amp;gt; d.valueName);
			
			this.tooltipServiceWrapper.addTooltip(this.barContainer.selectAll('.bar'),
				(tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; this.getTooltipData(tooltipEvent.data),
				(tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; null);
			
			// Title
			let fontSizeValue: number = Math.min(width, height) / 5;
			let fontSizeLabel: number = fontSizeValue / 4;
			this.title.append('text').attr({
				x: "50%",
				y: 16,
				fill: '#000',
				"text-anchor": "middle"
			}).text('Гистограмма с накоплением');

			
			
			legend.on('click', function(bar) {
				// Allow selection only if the visual is rendered in a view that supports interactivity (e.g. Report)
				if (allowInteractions) {
					selectionManager.select(bar.selectionId).then((ids: ISelectionId[]) =&amp;gt; {
						barsSeries.attr({
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});
						
						legend.attr({ //hide all legend
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});
						
						barsSeries.attr({ //show active bars
							'fill-opacity': d =&amp;gt; ids[0]['key'] == d.selectionId['key'] ? Visual.Config.solidOpacity : Visual.Config.transparentOpacity
						});
						
						d3.select(this).attr({ //show active legend
							'fill-opacity': Visual.Config.solidOpacity
						});
					});
					(&amp;lt;Event&amp;gt;d3.event).stopPropagation();
				}
			});
			}
			
			barsSeries.exit().remove();
			legend.exit().remove();
		}
		
		
		public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
			let objectName = options.objectName;
			let objectEnumeration: VisualObjectInstance[] = [];
			
			switch (objectName) {
				case 'enableAxis':
					objectEnumeration.push({
						objectName: objectName,
						properties: {
							show: this.VisualSettings.enableAxis.show,
						},
						selector: null
					});
					break;
				case 'colorSelector':
					for (let labelDataLegend of this.labelDataLegends) {
						objectEnumeration.push({
							objectName: objectName,
							displayName: labelDataLegend.valueName,
							properties: {
								fill: {
									solid: {
										color: labelDataLegend.color
									}
								}
							},
							selector: labelDataLegend.selectionId.getSelector()
						});
					}
					break;
				case 'generalView':
					objectEnumeration.push({
						objectName: objectName,
						properties: {
							opacity: this.VisualSettings.generalView.opacity,
						},
						validValues: {
							opacity: {
								numberRange: {
									min: 10,
									max: 100
								}
							}
						},
						selector: null
					});
					break;
				
				case 'legend':
					objectEnumeration.push({
						objectName: objectName,
						displayName: 'show',
						properties: {
							show: this.VisualSettings.legend.show
						},
						selector: null
					});
					break;
			};

			return objectEnumeration;
		}

		public destroy(): void {
			// Perform any cleanup tasks here
		}

		private getTooltipData(value: any): VisualTooltipDataItem[] {
			return [{
				displayName: value.valueName,
				value: value.value.toString(),
				color: value.color
			}];
		}
    }
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Oct 2017 08:11:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/263210#M8089</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-10-02T08:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/266673#M8123</link>
      <description>&lt;P&gt;There's an issue in selector:&lt;/P&gt;&lt;PRE&gt;this.barContainer.selectAll('dev').data(viewModel.dataPoints);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You must select all elements by ".bar" selector&amp;nbsp;instead of "dev" ("dev" selector assumes that there're DOM element called &amp;lt;DEV&amp;gt; but there aren't).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 09:40:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/266673#M8123</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-03T09:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/266796#M8125</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;replaced&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    "use strict";
	
	interface VisualViewModel {
		dataPoints: VisualDataPoint[];
		dataLegends: VisualDataLegend[];
		dataMax: number;
		settings: VisualSettings;
	};
	
	interface VisualDataPoint {
		category: string;
		valueName: string;
		value: PrimitiveValue;
		sumHeight: PrimitiveValue;
		conventions: string;
		color: string;
		selectionId: powerbi.visuals.ISelectionId;
	};
	
	interface VisualDataLegend {
		valueName: string;
		index: PrimitiveValue;
		conventions: string;
		color: string;
		selectionId: powerbi.visuals.ISelectionId;
	};
	
	interface VisualSettings {
		enableAxis: {
			show: boolean;
		};

		generalView: {
			opacity: number;
		};
		
		legend: {
			show: boolean;
		};
		/*
		colorSelector: {
			defaultColor: string[];
		};*/
	}
	
	
	function visualTransform(options: VisualUpdateOptions, host: IVisualHost): VisualViewModel {
		let dataViews = options.dataViews;
		let defaultSettings: VisualSettings = {
			enableAxis: {
				show: false
			},
			generalView: {
				opacity: 100
			},
			legend: {
				show: true
			}/*,
			colorSelector: {
				defaultColor: []
			}*/
		};
		let viewModel: VisualViewModel = {
			dataPoints: [],
			dataLegends: [],
			dataMax: 0,
			settings: &amp;lt;VisualSettings&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;
		
		let VisualDataPoints: VisualDataPoint[] = [];
		let VisualDataLegends: VisualDataLegend[] = [];
		let dataMax: number;

		let colorPalette: IColorPalette = host.colorPalette;
		let objects = dataViews[0].metadata.objects;
		let VisualSettings: VisualSettings = {
			enableAxis: {
				show: getValue&amp;lt;boolean&amp;gt;(objects, 'enableAxis', 'show', defaultSettings.enableAxis.show),
			},
			generalView: {
				opacity: getValue&amp;lt;number&amp;gt;(objects, 'generalView', 'opacity', defaultSettings.generalView.opacity),
			},
			legend: {
				show: getValue&amp;lt;boolean&amp;gt;(objects, 'legend', 'show', defaultSettings.legend.show),
			}/*,
			colorSelector: {
				defaultColor: []
			}*/
		};
		
		
		dataValue.sort(function(a,b) {return d3.ascending(a.source.groupName+'', b.source.groupName+'');});
		
		for (let k = 0; k &amp;lt; dataValue.length; k++) {
			
			//VisualSettings.colorSelector.defaultColor[k] = colorPalette.getColor(dataValue[k].source.groupName + '').value;

			VisualDataLegends.push({
				valueName: dataValue[k].source.groupName + '',
				index: k,
				conventions: 'dataValue[k].source.groupName',
				color: colorPalette.getColor(dataValue[k].source.groupName+'').value,
				selectionId: host.createSelectionIdBuilder().withMeasure(dataValue[k].source.groupName+'').createSelectionId()
			});
		}
		
		dataMax=0;
		dataValue.sort(function(a,b) {return d3.descending(a.source.groupName+'', b.source.groupName+'');});
		
		for (let i = 0; i &amp;lt; category.values.length; i++) {
			let sumHeight=0;
			for (let k = 0; k &amp;lt; dataValue.length; k++) {
				
				sumHeight += &amp;lt;number&amp;gt;dataValue[k].values[i];

				VisualDataPoints.push({
					category: category.values[i] + '',
					valueName: dataValue[k].source.groupName + '',
					value: dataValue[k].values[i],
					sumHeight: sumHeight,
					conventions: 'dataValue[k].source.groupName',
					color: colorPalette.getColor(dataValue[k].source.groupName+'').value,
					selectionId: host.createSelectionIdBuilder().withMeasure(dataValue[k].source.groupName+'').createSelectionId()
				});
			}
		dataMax = sumHeight &amp;gt; dataMax ? sumHeight : dataMax;
		}
		
		return {
			dataPoints: VisualDataPoints,
			dataLegends: VisualDataLegends,
			dataMax: dataMax,
			settings: VisualSettings,
		};
	}
	
	
    export class Visual implements IVisual {
		private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private host: IVisualHost;
		private selectionManager: ISelectionManager;
		private VisualContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private barContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private xAxis: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private labelDataLegends: VisualDataLegend[];
		private VisualSettings: VisualSettings;
		private tooltipServiceWrapper: ITooltipServiceWrapper;
		private locale: string;
		private title: d3.Selection&amp;lt;SVGElement&amp;gt;;
		private legend: d3.Selection&amp;lt;SVGElement&amp;gt;;

		static Config = {
			xScalePadding: 0.2,
			solidOpacity: 1,
			transparentOpacity: 0.5,
			margins: {
				top: 30,
				right: 160,
				bottom: 30,
				left: 0,
			},
			xAxisFontMultiplier: 0.04,
		};
		
		
		constructor(options: VisualConstructorOptions) {
			this.host = options.host;
			this.selectionManager = options.host.createSelectionManager();
			this.tooltipServiceWrapper = createTooltipServiceWrapper(this.host.tooltipService, options.element);
			let svg = this.svg = d3.select(options.element).append('svg').classed('Visual', true);
			this.locale = options.host.locale;
			this.barContainer = svg.append('g').classed('barContainer', true);
			this.xAxis = svg.append('g').classed('xAxis', true);
			this.title = svg.append("g").classed("textLabel", true);
			this.legend = svg.append("g").classed("legend", true);
		}

        public update(options: VisualUpdateOptions, title: string) {
			let viewModel: VisualViewModel = visualTransform(options, this.host);
			let settings = this.VisualSettings = viewModel.settings;
			this.labelDataLegends = viewModel.dataLegends;

			let width = options.viewport.width;
			let height = options.viewport.height;
			let margins = Visual.Config.margins;
			
			this.svg.attr({
				width: width,
				height: height
			});
			
			if (settings.enableAxis.show) { height -= margins.bottom; }
			if (settings.legend.show) { width -= margins.right; }
			height -= margins.top;
			width -= margins.left;
			
			this.xAxis.style({
				'font-size': d3.min([height, width]) * Visual.Config.xAxisFontMultiplier,
			});

			let yScale = d3.scale.linear()
				.domain([0, viewModel.dataMax])
				.range([height, 0]);
			let xScale = d3.scale.ordinal()
				.domain(viewModel.dataPoints.map(d =&amp;gt; d.category))
				.rangeRoundBands([0, width], Visual.Config.xScalePadding, 0.2);

			let xAxis = d3.svg.axis()
				.scale(xScale)
				.orient('bottom');

			this.xAxis.attr('transform', 'translate('+margins.left+', ' + (height+margins.top) + ')')
				.call(xAxis);
			
			// This must be an anonymous function instead of a lambda because
			// d3 uses 'this' as the reference to the element that was clicked.
			let selectionManager = this.selectionManager;
			let allowInteractions = this.host.allowInteractions;
			
			let legend = this.legend.selectAll('.legend').data(viewModel.dataLegends);
			
			//bars (with series)
			let barsSeries = this.barContainer.selectAll('.bar').data(viewModel.dataPoints);
			barsSeries.enter().append('rect').classed('bar', true).attr({
				width: xScale.rangeBand(),
				height: d =&amp;gt; height - yScale(&amp;lt;number&amp;gt;d.value),
				x: d =&amp;gt; xScale(d.category)+margins.left,
				y: d =&amp;gt; yScale(&amp;lt;number&amp;gt;d.sumHeight)+margins.top,
				fill: d =&amp;gt; d.color,
				'fill-opacity': viewModel.settings.generalView.opacity / 100
			});
			
			//console.log(viewModel.dataPoints);
			
			barsSeries.on('click', function(d) {
				// Allow selection only if the visual is rendered in a view that supports interactivity (e.g. Report)
				if (allowInteractions) {
					selectionManager.select(d.selectionId).then((ids: ISelectionId[]) =&amp;gt; {
						barsSeries.attr({
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});

						d3.select(this).attr({
							'fill-opacity': Visual.Config.solidOpacity
						});
						
						if (settings.legend.show) {
							legend.attr({
								'fill-opacity': Visual.Config.solidOpacity
							});
						}
					});
					(&amp;lt;Event&amp;gt;d3.event).stopPropagation();
				}
			});
			
			
			//Legends
			if (settings.legend.show) {
				
			legend.enter().append('circle').classed('legend', true).attr({
				r: 4,
				cx: width+margins.right-8,
				cy: d =&amp;gt; &amp;lt;number&amp;gt;d.index * 14+margins.top-4,
				fill: d =&amp;gt; d.color
			});
			
			legend.enter().append('text').classed('legend', true).attr({
				x: width+margins.right-20,
				y: d =&amp;gt; &amp;lt;number&amp;gt;d.index * 14+margins.top,
				'font-size': 12,
				fill: d =&amp;gt; '#777',
				'text-anchor': 'end'
			}).text(d =&amp;gt; d.valueName);
			
			legend.on('click', function(bar) {
				// Allow selection only if the visual is rendered in a view that supports interactivity (e.g. Report)
				if (allowInteractions) {
					selectionManager.select(bar.selectionId).then((ids: ISelectionId[]) =&amp;gt; {
						barsSeries.attr({
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});
						
						legend.attr({ //hide all legend
							'fill-opacity': ids.length &amp;gt; 0 ? Visual.Config.transparentOpacity : Visual.Config.solidOpacity
						});
						
						barsSeries.attr({ //show active bars
							'fill-opacity': d =&amp;gt; ids[0]['key'] == d.selectionId['key'] ? Visual.Config.solidOpacity : Visual.Config.transparentOpacity
						});
						
						d3.select(this).attr({ //show active legend
							'fill-opacity': Visual.Config.solidOpacity
						});
					});
					(&amp;lt;Event&amp;gt;d3.event).stopPropagation();
				}
			});
			}
			
			this.tooltipServiceWrapper.addTooltip(this.barContainer.selectAll('.bar'),
				(tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; this.getTooltipData(tooltipEvent.data),
				(tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; null);
			
			// Title
			let fontSizeValue: number = Math.min(width, height) / 5;
			let fontSizeLabel: number = fontSizeValue / 4;
			this.title.append('text').attr({
				x: "50%",
				y: 16,
				fill: '#000',
				"text-anchor": "middle"
			}).text('Гистограмма с накоплением');
			
			barsSeries.exit().remove();
			legend.exit().remove();
		}
		
		
		public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
			let objectName = options.objectName;
			let objectEnumeration: VisualObjectInstance[] = [];
			
			switch (objectName) {
				case 'enableAxis':
					objectEnumeration.push({
						objectName: objectName,
						properties: {
							show: this.VisualSettings.enableAxis.show,
						},
						selector: null
					});
					break;
				case 'colorSelector':
					for (let labelDataLegend of this.labelDataLegends) {
						objectEnumeration.push({
							objectName: objectName,
							displayName: labelDataLegend.valueName,
							properties: {
								fill: {
									solid: {
										color: labelDataLegend.color
									}
								}
							},
							selector: labelDataLegend.selectionId.getSelector()
						});
					}
					break;
				case 'generalView':
					objectEnumeration.push({
						objectName: objectName,
						properties: {
							opacity: this.VisualSettings.generalView.opacity,
						},
						validValues: {
							opacity: {
								numberRange: {
									min: 10,
									max: 100
								}
							}
						},
						selector: null
					});
					break;
				
				case 'legend':
					objectEnumeration.push({
						objectName: objectName,
						displayName: 'show',
						properties: {
							show: this.VisualSettings.legend.show
						},
						selector: null
					});
					break;
			};

			return objectEnumeration;
		}

		public destroy(): void {
			// Perform any cleanup tasks here
		}

		private getTooltipData(value: any): VisualTooltipDataItem[] {
			return [{
				displayName: value.valueName,
				value: value.value.toString(),
				color: value.color
			}];
		}
    }
}&lt;/PRE&gt;&lt;P&gt;May be i don't understand something, but, for example,&lt;U&gt;&amp;nbsp;this.legend = svg.append("g").classed("legend", true);&lt;/U&gt; - created "layer", then&lt;U&gt;&amp;nbsp;let legend = this.legend.selectAll('.legend').data(viewModel.dataLegends);&lt;/U&gt; - put some prepared elements with class "legend", fill with data, then put some elements based&amp;nbsp;at previous prepared elements&amp;nbsp;&lt;U&gt;legend.enter().append('circle').classed('legend', true)&lt;/U&gt;,&amp;nbsp;&lt;U&gt;legend.enter().append('text').classed('legend', true) &lt;/U&gt;?&lt;BR /&gt;So, we have some elements with data and visualization. Next, i have&amp;nbsp;&lt;U&gt;legend.on('click', function(bar)&lt;/U&gt;&amp;nbsp; that doing something at clicking&amp;nbsp;at "legends". Why it working with last&amp;nbsp;added&lt;U&gt; legend.enter().append('text')&lt;/U&gt; only , but not working at both (&lt;U&gt;legend.enter().append('circle')&lt;/U&gt; and&lt;U&gt;&amp;nbsp;legend.enter().append('text')&lt;/U&gt;). What i understand wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 10:44:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/266796#M8125</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-10-03T10:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/267833#M8135</link>
      <description>&lt;P&gt;I'm not sure that your D3 flow is correct. It'b be good to use this flow:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let legend = svg.selectAll('.legend').data(viewModel.dataLegends);

legend
    .enter()
    .append("&lt;U&gt;g&lt;/U&gt;")
    .classed("legend", true);
&lt;BR /&gt;let circle = legend.selectAll("circle").data([{put your data here}]);&lt;BR /&gt;&lt;BR /&gt;circle&lt;BR /&gt;    .enter()&lt;BR /&gt;    .append('circle');&lt;BR /&gt;&lt;BR /&gt;circle&lt;BR /&gt;    .exit()&lt;BR /&gt;    .remove();&lt;BR /&gt;&lt;BR /&gt;let text = legend.selectAll("text").data([{put your data here}]);&lt;U&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/U&gt;text&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;    .enter()&lt;U&gt;&lt;BR /&gt;&lt;/U&gt;    .append('text');&lt;BR /&gt;&lt;BR /&gt;text&lt;BR /&gt;    .exit()&lt;BR /&gt;    .remove();&lt;BR /&gt;
legend
    .exit()
    .remove();&lt;/PRE&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 09:38:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/267833#M8135</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-04T09:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/268148#M8142</link>
      <description>&lt;P&gt;trying to use it, is no difference...&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 14:26:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/268148#M8142</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-10-04T14:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/268986#M8172</link>
      <description>&lt;P&gt;Can you share the updated source code to investigate this issue deeper?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 09:32:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/268986#M8172</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-05T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/270626#M8212</link>
      <description>&lt;P&gt;I try to&amp;nbsp;make working only "title" (textLabel), but it still not working... i don't undersand why)&lt;/P&gt;&lt;PRE&gt;export class Visual implements IVisual {
		private textLabel: d3.Selection&amp;lt;SVGElement&amp;gt;;
...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;constructor(options: VisualConstructorOptions) {
			this.textLabel = svg.append("g").classed("textLabel", true);&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public update(options: VisualUpdateOptions, title: string) {&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;// Title
let fontSizeValue: number = Math.min(width, height) / 5;
let fontSizeLabel: number = fontSizeValue / 4;
let textLabel = this.textLabel; 
textLabel.append('text').attr({
	x: width/2,
	y: 16+'px',
	fill: '#000',
	"text-anchor": "middle"
}).text('Some text');&lt;BR /&gt;...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;UPD&lt;/P&gt;&lt;P&gt;I take example of sampleBarChart from Git, insert my code of textLabel - and situation repeats but only with textLabel. Bars are ok.&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {
    /**
     * Interface for BarCharts viewmodel.
     *
     * @interface
     * @property {BarChartDataPoint[]} dataPoints - Set of data points the visual will render.
     * @property {number} dataMax                 - Maximum data value in the set of data points.
     */
    interface BarChartViewModel {
        dataPoints: BarChartDataPoint[];
        dataMax: number;
        settings: BarChartSettings;
    };

    /**
     * Interface for BarChart data points.
     *
     * @interface
     * @property {number} value             - Data value for point.
     * @property {string} category          - Corresponding category of data value.
     * @property {string} color             - Color corresponding to data point.
     * @property {ISelectionId} selectionId - Id assigned to data point for cross filtering
     *                                        and visual interaction.
     */
    interface BarChartDataPoint {
        value: PrimitiveValue;
        category: string;
        color: string;
        selectionId: powerbi.visuals.ISelectionId;
    };

    /**
     * Interface for BarChart settings.
     *
     * @interface
     * @property {{show:boolean}} enableAxis - Object property that allows axis to be enabled.
     */
    interface BarChartSettings {
        enableAxis: {
            show: boolean;
        };

        generalView: {
            opacity: number;
        };
    }

    /**
     * Function that converts queried data into a view model that will be used by the visual.
     *
     * @function
     * @param {VisualUpdateOptions} options - Contains references to the size of the container
     *                                        and the dataView which contains all the data
     *                                        the visual had queried.
     * @param {IVisualHost} host            - Contains references to the host which contains services
     */
    function visualTransform(options: VisualUpdateOptions, host: IVisualHost): BarChartViewModel {
        let dataViews = options.dataViews;
        let defaultSettings: BarChartSettings = {
            enableAxis: {
                show: false,
            },
            generalView: {
                opacity: 100
            }
        };
        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),
            },
            generalView: {
                opacity: getValue&amp;lt;number&amp;gt;(objects, 'generalView', 'opacity', defaultSettings.generalView.opacity),
            }
        };
        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,
        };
    }

    export class BarChart implements IVisual {
        private svg: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private host: IVisualHost;
        private selectionManager: ISelectionManager;
        private barChartContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private barContainer: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private xAxis: d3.Selection&amp;lt;SVGElement&amp;gt;;
        private barDataPoints: BarChartDataPoint[];
        private barChartSettings: BarChartSettings;
        private tooltipServiceWrapper: ITooltipServiceWrapper;
        private locale: string;
		private textLabel: d3.Selection&amp;lt;SVGElement&amp;gt;;

        static Config = {
            xScalePadding: 0.1,
            solidOpacity: 1,
            transparentOpacity: 0.5,
            margins: {
                top: 0,
                right: 0,
                bottom: 25,
                left: 30,
            },
            xAxisFontMultiplier: 0.04,
        };

        /**
         * Creates instance of BarChart. This method is only called once.
         *
         * @constructor
         * @param {VisualConstructorOptions} options - Contains references to the element that will
         *                                             contain the visual and a reference to the host
         *                                             which contains services.
         */
        constructor(options: VisualConstructorOptions) {
            this.host = options.host;
            this.selectionManager = options.host.createSelectionManager();
            this.tooltipServiceWrapper = createTooltipServiceWrapper(this.host.tooltipService, options.element);
            let svg = this.svg = d3.select(options.element)
                .append('svg')
                .classed('barChart', true);

            this.locale = options.host.locale;

            this.barContainer = svg.append('g')
                .classed('barContainer', true);

            this.xAxis = svg.append('g')
                .classed('xAxis', true);
				this.textLabel = svg.append("g").classed("textLabel", true);
        }

        /**
         * Updates the state of the visual. Every sequential databinding and resize will call update.
         *
         * @function
         * @param {VisualUpdateOptions} options - Contains references to the size of the container
         *                                        and the dataView which contains all the data
         *                                        the visual had queried.
         */
        public update(options: VisualUpdateOptions) {
            let viewModel: BarChartViewModel = visualTransform(options, this.host);
            let settings = this.barChartSettings = viewModel.settings;
            this.barDataPoints = viewModel.dataPoints;

            let width = options.viewport.width;
            let height = options.viewport.height;

            this.svg.attr({
                width: width,
                height: height
            });

            if (settings.enableAxis.show) {
                let margins = BarChart.Config.margins;
                height -= margins.bottom;
            }

            this.xAxis.style({
                'font-size': d3.min([height, width]) * BarChart.Config.xAxisFontMultiplier,
            });

            let yScale = d3.scale.linear()
                .domain([0, viewModel.dataMax])
                .range([height, 0]);

            let xScale = d3.scale.ordinal()
                .domain(viewModel.dataPoints.map(d =&amp;gt; d.category))
                .rangeRoundBands([0, width], BarChart.Config.xScalePadding, 0.2);

            let xAxis = d3.svg.axis()
                .scale(xScale)
                .orient('bottom');

            this.xAxis.attr('transform', 'translate(0, ' + height + ')')
                .call(xAxis);

            let bars = this.barContainer.selectAll('.bar').data(viewModel.dataPoints);
            bars.enter()
                .append('rect')
                .classed('bar', true);

            bars.attr({
                width: xScale.rangeBand(),
                height: d =&amp;gt; height - yScale(&amp;lt;number&amp;gt;d.value),
                y: d =&amp;gt; yScale(&amp;lt;number&amp;gt;d.value),
                x: d =&amp;gt; xScale(d.category),
                fill: d =&amp;gt; d.color,
                'fill-opacity': viewModel.settings.generalView.opacity / 100
            });
			
			// Title
			let fontSizeValue: number = Math.min(width, height) / 5;
			let fontSizeLabel: number = fontSizeValue / 4;
			let textLabel = this.textLabel; 
			textLabel.append('text').attr({
				x: width/2,
				y: 16+'px',
				fill: '#000',
				"text-anchor": "middle"
			}).text('Some text');

            this.tooltipServiceWrapper.addTooltip(this.barContainer.selectAll('.bar'),
                (tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; this.getTooltipData(tooltipEvent.data),
                (tooltipEvent: TooltipEventArgs&amp;lt;number&amp;gt;) =&amp;gt; null);

            let selectionManager = this.selectionManager;
            let allowInteractions = this.host.allowInteractions;

            // This must be an anonymous function instead of a lambda because
            // d3 uses 'this' as the reference to the element that was clicked.
            bars.on('click', function(d) {
				// Allow selection only if the visual is rendered in a view that supports interactivity (e.g. Report)
                if (allowInteractions) {
                    selectionManager.select(d.selectionId).then((ids: ISelectionId[]) =&amp;gt; {
                        bars.attr({
                            'fill-opacity': ids.length &amp;gt; 0 ? BarChart.Config.transparentOpacity : BarChart.Config.solidOpacity
                        });

                        d3.select(this).attr({
                            'fill-opacity': BarChart.Config.solidOpacity
                        });
                    });

                    (&amp;lt;Event&amp;gt;d3.event).stopPropagation();
                }
            });

            bars.exit()
               .remove();
        }

        /**
         * Enumerates through the objects defined in the capabilities and adds the properties to the format pane
         *
         * @function
         * @param {EnumerateVisualObjectInstancesOptions} options - Map of defined objects
         */
        public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
            let objectName = options.objectName;
            let objectEnumeration: VisualObjectInstance[] = [];

            switch (objectName) {
                case 'enableAxis':
                    objectEnumeration.push({
                        objectName: objectName,
                        properties: {
                            show: this.barChartSettings.enableAxis.show,
                        },
                        selector: null
                    });
                    break;
                case 'colorSelector':
                    for (let barDataPoint of this.barDataPoints) {
                        objectEnumeration.push({
                            objectName: objectName,
                            displayName: barDataPoint.category,
                            properties: {
                                fill: {
                                    solid: {
                                        color: barDataPoint.color
                                    }
                                }
                            },
                            selector: barDataPoint.selectionId.getSelector()
                        });
                    }
                    break;
                case 'generalView':
                    objectEnumeration.push({
                        objectName: objectName,
                        properties: {
                            opacity: this.barChartSettings.generalView.opacity,
                        },
                        validValues: {
                            opacity: {
                                numberRange: {
                                    min: 10,
                                    max: 100
                                }
                            }
                        },
                        selector: null
                    });
                    break;
            };

            return objectEnumeration;
        }

        /**
         * Destroy runs when the visual is removed. Any cleanup that the visual needs to
         * do should be done here.
         *
         * @function
         */
        public destroy(): void {
            // Perform any cleanup tasks here
        }

        private getTooltipData(value: any): VisualTooltipDataItem[] {
            let language = getLocalizedString(this.locale, "LanguageKey");
            return [{
                displayName: value.category,
                value: value.value.toString(),
                color: value.color,
                header: language &amp;amp;&amp;amp; "displayed language " + language
            }];
        }
    }
}&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2017 13:20:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/270626#M8212</guid>
      <dc:creator>ShutTap</dc:creator>
      <dc:date>2017-10-06T13:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create stacked column chart</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/273090#M8225</link>
      <description>&lt;P&gt;Your code creates a new element for each update call.&lt;/P&gt;&lt;P&gt;This issue can be fixed by using &lt;A href="https://github.com/d3/d3-3.x-api-reference/blob/master/Selections.md#data" target="_blank"&gt;D3's data-binding&lt;/A&gt;. It will look something like this in your case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;const textLabelSelection = this.textLabel
    .selectAll("text")
    .data(["Some text"]);

textLabelSelection
    .enter()
    .append("text");

textLabelSelection
    .attr({
        x: width / 2,
        y: 16 + 'px',
    })
    .style({
        fill: '#000',
        "text-anchor": "middle",
    })
    .text((textValue) =&amp;gt; textValue);

textLabelSelection
    .exit()
    .remove();&lt;/PRE&gt;&lt;P&gt;Ignat Vilesov,&lt;/P&gt;&lt;P&gt;Software Engineer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft Power BI Custom Visuals&lt;/P&gt;&lt;P&gt;&lt;A href="mailto:pbicvsupport@microsoft.com" target="_blank"&gt;&lt;SPAN&gt;pbicvsupport@microsoft.com&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 07:24:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Create-stacked-column-chart/m-p/273090#M8225</guid>
      <dc:creator>v-viig</dc:creator>
      <dc:date>2017-10-09T07:24:45Z</dc:date>
    </item>
  </channel>
</rss>

