如何在LineSeries图上显示文本?

时间:2017-06-07 17:32:42

标签: c# oxyplot

我试图将一个点的值打印到图上,但提供的文档不完整或令人困惑。我知道TrackerFormatString值可以做类似的事情,但我希望文本始终位于动态改变不同值的图上。有什么东西我可能会忽略或者我可以调查一下吗?

doAttach : function(component, event, helper) {
    var elem = event.target || event.srcElement; 
    var fileInput = $("#file-upload");

    if(fileInput[0].files.length <= 0){
        alert('You have to select a file to upload!');
        return;
    }

    var file = fileInput[0].files[0];
    if(file.size > 4500000){ // 6000000 * 3/4 to account for base64 
        alert('File size cannot exceed ' + this.MAX_FILE_SIZE + ' bytes.\n' +
                'Selected file size: ' + file.size);
        return;
    }

    //display panel loading
    $('#loading-status').css("display", "block");
    $(elem).attr('disabled', 'disabled');

    var filename = file.name;
    var filesize = file.size;
    var fileblob;
    var reader = new FileReader();
    reader.onload = function(readerEvt){
        var binaryString = readerEvt.target.result;
        fileblob = btoa(binaryString);

        var obj = {"filename" : filename,
                   "filesize" : filesize,
                   "body" : fileblob};
        var lstresult = component.get("v.lstAttachments"); 
        lstresult.push(obj);
        component.set("v.lstAttachments", lstresult); 

        $("#elem-upload").css("display", "inline-flex");
        $("#itemUploaded").css("display", "none");  
        $("#tbl-result").css("display", "table");
        $('#loading-status').css("display", "none");
        $("#btn-attach").attr('disabled', 'disabled');
    };
    reader.readAsBinaryString(file);
},

This is what I have:

This is what I need:

非常感谢任何形式的帮助!

1 个答案:

答案 0 :(得分:0)

You can add annotations to your plot. For displaying text use TextAnnotation.

Add the annotations to your model, providing a DataPoint for the location and the Text for the text to display. For example

yourModel.Annotations.Add(new TextAnnotation { TextPosition = new DataPoint(DateTimeAxis.ToDouble(now), wert), Text = "82.3%" });