Important: Please read the Qt Code of Conduct -

QtCharts Does not support Alpha?

  • Does the chart module not support use of alpha in color definitions?

    I was attempting to remove the border of a pie slice. Setting border to 0 does not do it. Nor does setting the border color to transparent. I then discovered that any color definitions seem to just silently ignore alpha channel. I even went so far as to link into some C++ code to manually control the brushes/pens/colors without going through QML and that does not work either.

    I suspected the more limited openGL might be the issue, but pie would not be supported by that. I tried other series types (line, bar, etc) and all behave the same.


  • Can you make a minimal qml app that reproduces the problem with nothing else in that app? Then share your code so we have something to look at?

  • Hello,

    As I made my minimal application, I discovered that it does work with alpha in colors as expected BUT turning on animations causes it to ignore the alpha channel for the animated items...

    I opened the qmlchart example, and modify View1.qml:

    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact:
    ** This file is part of the Qt Charts module of the Qt Toolkit.
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see For further
    ** information use the contact form at
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met:
    import QtQuick 2.0
    import QtCharts 2.0
    Item {
        anchors.fill: parent
        property variant othersSlice: 0
        //Just to give a background to see transparency easier...
        Image {
            id: image
            anchors.fill: parent
            source: ""
            fillMode: Image.Stretch
            opacity: 0.3
        ChartView {
            id: chart
            title: "Top-5 car brand shares in Finland"
            anchors.fill: parent
            legend.alignment: Qt.AlignBottom
            antialiasing: true
            backgroundColor: "#0100FF00"
            animationOptions: ChartView.AllAnimations //<--kills alpha channel if have animations on
            PieSeries {
                id: pieSeries
                holeSize: .3
                PieSlice { label: "Volkswagen"; value: 25; color: "#50FF0000" }
                PieSlice { label: "Toyota"; value: 10.9;  color: "#3000FF00"}
                PieSlice { label: "Ford"; value: 8.6; color: "#800000FF" }
                PieSlice { label: "Skoda"; value: 8.2 }
                PieSlice { label: "Volvo"; value: 6.8 }
        Component.onCompleted: {
            // You can also manipulate slices dynamically, like append a slice or set a slice exploded
            othersSlice = pieSeries.append("Others", 52.0);
            pieSeries.find("Volkswagen").exploded = true;

    And then the alpha is being ignored. I know working with transparency will be a bit more costly, but I definitely did not anticipate total disabling. Is this intended? Or a bug I should be reporting?

    This is on qt 5.14.2, mac, but seems to do the same other places i have looked at (not 5.15 yet...)

  • I played with this a bit. It looks like once animations are enabled you lose transparency. I don't see anything in the docs about this either. So either it is an optimization or a bug. Since you have a simple reproducible example I would submit a bug.

Log in to reply