import QtQuick 2.15
import QtCharts 2.15
Item {

    property int axisxMax
    property int axisxMin
    property int axisyMax
    property int axisyMin
    property alias spline:splineSeries
    property alias name:splineSeries.name
    property alias charView:charView

    function setRange_X(min, max){
        axisxMin=min
        axisxMax=max
    }

    function setRange_Y(min, max){
        axisyMin=min
        axisyMax=max
    }

    function scatter_add(x,y){
        scatter.append(x, y)
    }

    function scatter_clear(){
        scatter.clear()
    }

    ChartView{
        id:charView
        anchors.fill: parent
        antialiasing:true

        ValueAxis{
            id:axisx
            max:axisxMax;
            min:axisxMin;
            tickCount: 13
        }

        ValueAxis{
            id:axisy
            max:axisyMax;
            min:axisyMin;
            tickCount: 15
        }
        SplineSeries{
            id:splineSeries
            color: Qt.rgba(255,0,0,1)

            axisX: axisx
            axisY: axisy
            useOpenGL: false
        }

        ScatterSeries {
               id: scatter
               name: "保压分割点"
               axisX: axisx
               axisY: axisy

               color: Qt.rgba(0,0,255,1)
               borderColor: Qt.rgba(0,0,255,1)
               borderWidth: 0
               markerSize: 4

               pointLabelsVisible:true
               pointLabelsFormat:"@yPoint"
               pointLabelsColor: Qt.rgba(0,0,255,1)
               //pointLabelsFont:

           }

    }

}
