Advertisement
Guest User

Untitled

a guest
Aug 5th, 2019
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 1.66 KB | None | 0 0
  1. QML ChartView: LineSeries and SplineSeries has a default color if width of series equals default value or 1
  2.  
  3. import QtQuick 2.12
  4. import QtQuick.Window 2.12
  5. import QtCharts 2.3
  6.  
  7. Window {
  8.     visible: true
  9.     width: 640
  10.     height: 480
  11.  
  12.     ChartView {
  13.         anchors.fill: parent
  14.         ValueAxis {
  15.             id: xAxis
  16.             min: 0
  17.             max: 3
  18.         }
  19.         ValueAxis {
  20.             id: yAxis
  21.             min: -1
  22.             max: 2
  23.         }
  24.  
  25.         LineSeries {
  26.             id: bugSeries
  27.             axisX: xAxis
  28.             axisY: yAxis
  29.             color: "black" // [1] set black color to series
  30.             width: 1 // [2] set value 1 to width
  31.             // this series has default color on plot
  32.             name: "Bug series"
  33.         }
  34.  
  35.         LineSeries {
  36.             id: normalSeries
  37.             axisX: xAxis
  38.             axisY: yAxis
  39.             color: "black" // [3] set black color to series
  40.             width: 2 // [4] set value 2 to width
  41.             // this series has black color on plot
  42.             name: "Normal series"
  43.         }
  44.  
  45.         Component.onCompleted: {
  46.             for (var i = 0; i < 300; ++i)
  47.             {
  48.                 var x = i / 100
  49.                 var y = Math.sin(x)
  50.                 bugSeries.append(x, y)
  51.                 normalSeries.append(x, y+1)
  52.             }
  53.         }
  54.     }
  55. }
  56.  
  57.  
  58. expected:
  59.    bugSeries has setted color
  60.  
  61. actual:
  62.    if width of LiseSeries equals default value or 1 then LineSeries ignore setted value to property "color" and has default color.
  63.    bugSeries has width value equals 1 and default color
  64.    normalSeries has setted color
  65.  
  66. Qt 5.12.4
  67. gcc-9 9.1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement