Skip to content
  • 0 Votes
    7 Posts
    445 Views
    B

    @hemang_1711 I have just gone back to your original post and I see again what originally confused me.

    If you recall, I asked about GraphParam, which you are trying to access in your QML. I looked for this in your model implementation, but your model does not have a role "GraphParam".

    You do have a role "GraphList", which seems to return the first element of the list member named GraphParam in the GraphModelItem struct in your implementation. Although GraphParam is the name of the struct member, QML does not know anything about this name. It only sees the names you have defined in your roles.

  • 0 Votes
    1 Posts
    150 Views
    No one has replied
  • 0 Votes
    1 Posts
    140 Views
    No one has replied
  • 0 Votes
    8 Posts
    1k Views
    jsulmJ

    @StudyQt1 said in Plotting chart using lots of data:

    Is there a generic way to decide?

    Use a profiler. If you're using GCC you can use https://www.thegeekstuff.com/2012/08/gprof-tutorial/
    Easier way which is often enough is simply to put debug output at the beginning and end of your methods/functions with timestamps and then check the output of your application while it is running.

  • 0 Votes
    5 Posts
    946 Views
    V

    @J-Hilk
    Ok that's enough I think.

    One more question what will happen to scrolleft().

    If I keep on incrementing these, will there be any increase in runtime memory or processor load?

  • 0 Votes
    2 Posts
    261 Views
    T

    Hello! If I understood correctly, and you want to use the same chart view to represent the data in different forms like bars or line, I don't see any reason why not.
    If you take a look at https://doc.qt.io/qt-5/qtcharts-lineandbar-example.html, you can find an example of showing both a bar and line charts in the same chart, at the same time. From there, you can modify to show just one at a time, so in your case switching between the series when the menu action is triggered.

  • 0 Votes
    6 Posts
    1k Views
    C

    Hereby a solution that works for me. Instead of using a repeater, this codesample works with the ChartView's onCompleted signal handler. In the onCompleted handler first three LineSeries are dynamically created, then an AreaSeries is created.

    ChartView { id: chartid anchors.fill: parent antialiasing: true //Valueaxis ValueAxis{ id:xAxis; min: 0; max: 40000; tickCount: 9 } ValueAxis{ id:yAxis; min: -200; max: 1400; tickCount: 17 } //Listmodel only for testing Area- and LineSeries concept ListModel{ id: listModel ListElement { x1: 18000; y1: -100; x2: 18000 ; y2: 400 } ListElement { x1: 25000; y1: -100; x2: 25000 ; y2: 1000 } ListElement { x1: 31000; y1: -100; x2: 31000 ; y2: 1200 } ListElement { x1: 36500; y1: -100; x2: 39700 ; y2: 1250 } } Component.onCompleted: { var count = listModel.count; for(var i = 0;i < count;i ++) { if (i < count - 1) // add LineSeries { var lineTypeSeries = chartid.createSeries(ChartView.SeriesTypeLine, "line" + i, xAxis, yAxis); lineTypeSeries.color = "black"; lineTypeSeries.width = 2; lineTypeSeries.borderWidth = 0; lineTypeSeries.append(listModel.get(i).x1, listModel.get(i).y1); lineTypeSeries.append(listModel.get(i).x2, listModel.get(i).y2); } else { var areaTypeSeries = chartid.createSeries(ChartView.SeriesTypeArea, "area" + i, xAxis, yAxis); areaTypeSeries.pointsVisible = true; areaTypeSeries.color = "lightgrey"; areaTypeSeries.borderColor = "black"; areaTypeSeries.borderWidth = 2; areaTypeSeries.lowerSeries = chartid.createSeries(ChartView.SeriesTypeLine, "lowerSerie"); areaTypeSeries.lowerSeries.width = 0; areaTypeSeries.lowerSeries.borderWidth = 0; areaTypeSeries.lowerSeries.color = areaTypeSeries.borderColor; areaTypeSeries.lowerSeries.capStyle = 0x00; areaTypeSeries.lowerSeries.append(listModel.get(i).x1, listModel.get(i).y1); areaTypeSeries.lowerSeries.append(listModel.get(i).x2, listModel.get(i).y1); areaTypeSeries.upperSeries.append(listModel.get(i).x1, listModel.get(i).y2); areaTypeSeries.upperSeries.append(listModel.get(i).x2, listModel.get(i).y2); } } } }