0

I have already defined listBox with all the functionality (It is a Graph with a dragging points). Around ListBox I want to add "GridLines" on X and Y axis (I hope thats the right word - data info on X axis and data info on Y axis - example - hour times every half hour or so on X and 0-100% on Y axis).

So on X axis I like to have hour from 0:00 to 24:00 and on Y axis % from 0 - 100. I can use normal label or textblock and write number in is the simplest idea. But because grid of listbox will change depending on the data, I like to have manageable scaling. Start is always eg. 0 and end is also always eg. 100%. I like to scale infos that show infos every 20 units (0%, 20%, 40%, 60%, 80% and 100%) or every 25% (0%, 25%, 50%, 75%, 100%) or so.

I think do it with a Borders (for little marking line) and in next row with TextBlock define value. All this wrap in DataTemplate.

If something unclear or have any questions please ask.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
esispaned
  • 283
  • 5
  • 20
  • I don't think `ListBox` is the best choice for what you're trying to achieve. Either use `Canvas` or `Grapics namespace` to draw whatever you want using GDI+. It's both faster and more appropriate for drawing graphs. – LightBulb Sep 23 '15 at 11:38
  • Sorry. It is Canvas yes. I mix up, because ListBox is use to show grid in background. Sorry! like this example [link](http://stackoverflow.com/questions/15579069/graph-nodes-coordinates-evaluation) – esispaned Sep 23 '15 at 11:41

1 Answers1

1

It sounds like the hard part of your problem is determining what grid line intervals to use. I describe a nice algorithm here that produces ranges which are pleasing to a viewer.

With this, you can then divide the dimension into spaces and scale the values accordingly. Whatever logic you use for the positioning of points should also be updated.

For drawing lines, you can add Line shapes to your Canvas.

Community
  • 1
  • 1
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742