Using the Line chart and the dotted/dashed option is not working


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by TM on 6th February 2018
Hello,

I'm using RGraph to create a combo bar/line graph. I've got everything working except for the dotted/dashed function. I'm trying to set it via the dashed: true (or dotted: true) option. Am I missing something? This is my code:

var bar = new RGraph.Bar({
          id: 'cvs',
          data: [totalActNov, totalActDec, totalActJan, totalActFeb, totalActMar, totalActApr, totalActMay, totalActJun, totalActJul, totalActAug, totalActSep, totalActOct],
          options: {
              labels: ["Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct"],
              //colors: ['rgba(91,155,213,1)'],
              colors: ['#6fa36c'],
              textSize: 11,
              title: 'Gross Sales Results vs. Plan',
              labelsAbove: true,
              labelsAboveDecimals: 0,
              labelsAboveUnitsPre: '$',
              labelsAboveOffset: -50,
              numyticks: 10,
              backgroundGrid: false,
              titleXaxis: 'Month',
              titleXaxisSize: 10,
              titleYaxis: 'Actual Gross Sales ($)',
              titleYaxisSize: 10,
              titleYaxisX: 10,
              gutterLeft: 100,
              gutterTop: 50,
              ymax: 40000000
          }
      })
 
   var line = new RGraph.Line({
    id: 'cvs',
    data: [totalPlanNov, totalPlanDec, totalPlanJan, totalPlanFeb, totalPlanMar, totalPlanApr, totalPlanMay, totalPlanJun, totalPlanJul, totalPlanAug, totalPlanSep, totalPlanOct],
    options: {
     dotted: true,
     noaxes: true,
     backgroundGrid: false,
     labelsAbove: true,
              labelsAboveDecimals: 0,
              labelsAboveUnitsPre: '$',
     ymax: 40000000
    }
   })
  
   var combo = new RGraph.CombinedChart(bar, line);
   combo.draw();
Posted by Richard on 6th February 2018
Hi there,

You just need to use the correct set of options. Here's an example that's similar to yours and has a dashed background grid:

www.rgraph.net/fiddle/view.html/new-rgraph-example-that-uses-a-dashed-background-grid


Richard
Posted by TM on 6th February 2018
Hi Richard,

Thanks for the response, but it's not quite what I'm looking for. I'm looking for a dashed/dotted line on the graph instead of a solid line. I saw it in the Line documentation under the miscellaneous section: www.rgraph.net/canvas/docs/line.html#miscellaneous (last two).
Posted by Richard on 6th February 2018
Hi there,

Ah. IIRC that's only supported by the spline chart like this:

www.rgraph.net/fiddle/view.html/new-rgraph-example-that-uses-a-dashed-background-grid

Richard
Posted by TM on 6th February 2018
Ahhh, that did it. Thanks for the assistance!

Add a reply




« Back to message list