Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
_JamesB
Frequent Visitor

Visual retains old data on update

Hi There,

 

I'm having an issue with a custom visual that I am developing.  As far as I can tell there's no real difference from a previous visual that I created that doesn't suffer from this issue.  When the data that feeds into my visual changes, the old data is retained such that text becomes illegible (see screenshots at the bottom).

 

An example of the code that draws out the values:

 

    let Values = container
            .selectAll('.value')
            .data(viewModel.dataPoints)

        Values.enter()
            .append('rect')
            .classed('.value', true)

        Values
            .attr({
                width: d => d.Width,
                height: d => d.ValueHeight,
                x: d => d.ValueX,
                y: d => d.ValueY
            })
            .style({
                'display': 'block',
                'stroke': "Black",
                'fill': "none",
                'stroke-width': 1
            })

        Values.enter()
            .append('text')
            .classed('.value', true)

        Values
            .text(d => d.DisplayValue)
            .style({
                "display": "block",
                "font-size": "14px",
                "text-anchor": "middle",
                "alignment-baseline": "central",
                "fill": "Black"
            })
            .attr({
                width: d => d.Width,
                height: d => d.ValueHeight,
                x: d => d.ValueX + d.Width / 2,
                y: d => d.ValueY + d.ValueHeight / 2
            })

Does anyone know why this isn't working?

 

Many Thanks,

James

 

When I first load the visualWhen I first load the visual

 

After I cause an update via a SlicerAfter I cause an update via a Slicer

 

1 REPLY 1
_JamesB
Frequent Visitor

I worked out what was wrong as I read through the post to check for spelling.

 

You shouldn't append two different objects (in my case rect and text) to the same group with the same data bound to it.  Splitting the two object types into two different groups solved the issue.

 

Thanks,

James

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.