zedgraph: how to get dashed lines independant of physical graph size or # of data points

799 views Asked by At

when i plot my data, the dashes are only visible if: the # of data points is small, or if i manually widen the window, or if i zoom in on the graph. my expectation is that i'd see dashes regardless of these factors, as you'd get in excel. am i overlooking a zedgraph config? thanks very much.

   void plot_array(ref ZedGraphControl zgc)
   {
       int num_samples = 100;
       double[] xvals = new double[num_samples];
       double[] yvals = new double[num_samples];

       for (double i = 0; i < num_samples; i++)
       {
           xvals[(int)i] = i / 10;
           yvals[(int)i] = Math.Sin(i / 10);
       }

       var lineItem = zgc.GraphPane.AddCurve("Can't see the dashes", xvals, yvals, Color.Black);

       lineItem.Line.Style = System.Drawing.Drawing2D.DashStyle.Custom;
       lineItem.Line.DashOn = 10;
       lineItem.Line.DashOff = 10;
       lineItem.Symbol.Type = SymbolType.None;

       zgc.AxisChange();
       zgc.Refresh();
   }
1

There are 1 answers

4
chouaib On

Obvious , nothing is wrong with your settings, everything is normal since you have lot of data the dashed line tends to (look) straight line. if you try:

lineItem.Line.DashOn = 1;
lineItem.Line.DashOff = 10;

it solves your problem