title: Console chart drawing
body: <p>I need a way to draw a <code>Dictionary&lt;int,int&gt;</code> into a console application like</p>
  
  <pre><code>Dictionary&lt;int, int&gt; chartList = new Dictionary&lt;int, int&gt;()
  {
          {50,31}, // x = 50, y = 31
          {71,87},
          {25,66},
          {94,15},
          {33,94}
  };
  DrawChart(chartList);
  </code></pre>
  
  <p>should result in something like</p>
  
  <p><a href="https://i.stack.imgur.com/LT09d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LT09d.png" alt="enter image description here"></a></p>
  
  <p>I've come this far but i'm stuck at the <code>IsHit</code> method, which determines if at the current coordinates should be set a point or not. Could anyone help me at this point? It returns always true.</p>
  
  <pre><code>public static void DrawChart(Dictionary&lt;int, int&gt; dict)
  {
      int consoleWidth = 78;
      int consoleHeight = 20;
  
      Console.WriteLine(dict.Max(x =&gt; x.Key).ToString());
  
      Func&lt;int, int, bool&gt; IsHit = (hx, hy) =&gt; dict.Any(dct =&gt; dct.Key / dict.Max(x =&gt; x.Key) == hx / dict.Max(x =&gt; x.Key) &amp;&amp; dct.Value / dict.Max(x =&gt; x.Value) == hy / dict.Max(x =&gt; x.Value));
  
      for (int i = 0; i &lt; consoleHeight; i++)
      {
          Console.Write(i == 0 ? '┌' : '│');
          for (int j = 0; j &lt; consoleWidth; j++)
          {
              int actualheight = i * 2;
  
              if (IsHit(j, actualheight) &amp;&amp; IsHit(j, actualheight + 1))
              {
                  Console.ForegroundColor = ConsoleColor.Red;
                  Console.BackgroundColor = ConsoleColor.Black;
                  Console.Write('█');
              }
              else if (IsHit(j, actualheight))
              {
                  Console.ForegroundColor = ConsoleColor.Red;
                  Console.BackgroundColor = ConsoleColor.Black;
                  Console.Write('▀');
              }
              else if (IsHit(j, actualheight + 1))
              {
                  Console.ForegroundColor = ConsoleColor.Black;
                  Console.BackgroundColor = ConsoleColor.Red;
                  Console.Write('▀');
              }
          }
          Console.ResetColor();
          Console.WriteLine();
      }
      Console.WriteLine('└' + new string('─', (consoleWidth / 2) - 1) + '┴' + new string('─', (consoleWidth / 2) - 1) + '┘');
      Console.Write((dict.Min(x =&gt; x.Key) + "/" + dict.Min(x =&gt; x.Value)).PadRight(consoleWidth / 3));
      Console.Write((dict.Max(x =&gt; x.Value) / 2).ToString().PadLeft(consoleWidth / 3 / 2).PadRight(consoleWidth / 3));
      Console.WriteLine(dict.Max(x =&gt; x.Value).ToString().PadLeft(consoleWidth / 3));
  }
  </code></pre>