Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

javascript - How can I show only the last point of a Flot chart

I have made a Flot chart that uses the settings below and the graph depicted is a line with 4 points (every time). I want only the last dot (point) to be shown. Have you got any idea how can I do it? (Or probably can you tell me a way in order to put a step in my graph and show only dot after 3 points?)

var chart_plot_01_settings = {
          series: {

            lines: {
              show: false,
              fill: 1,  
            },

            splines: {
              show: true,
              tension: 0.4,
              lineWidth: 2,
              fill: 0.1,
            },

            points: {
              radius: 8,
              lineWidth: 1,
              show: false,
              symbol: "circle",
              fillColor: SentimentCircle
            },

            shadowSize: 1

          },
          grid: {
            verticalLines: true,
            hoverable: true,
            clickable: true,
            tickColor: "#000",
            borderWidth: 1,
            color: '#fff'
          },
          colors: ['#888'],

          xaxis: {
            tickColor: "#fff",
            mode: "time",
            tickSize: [1, "month"],
            axisLabel: "month",
            axisLabelUseCanvas: true,
            axisLabelFontSizePixels: 12,
            axisLabelFontFamily: 'Verdana, Arial',
            axisLabelPadding: 10
          },
          yaxis: {
            show: false,
            ticks: 8,
            tickColor: "#fff",
          },
           tooltip: false,
        }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

That is not possible with the normal options. What you can do is copy only the last data point to a second data series and for that data series use points: { show: true } in the options to show the point.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...