My purpose is to create two types graphics in php: pie, linear and represent data in each other.

Each graph should have own settings representation like: labels, texts.

In pie graph is required to display number of indicator as number or in percent.

I have begun with defenition of interface and abstract class:

```
interface IGraph {
  function percent();
  function percentGroup($type);
}

abstract class Graph implements IGraph {
  abstract function source();
  abstract function percent();
  abstract function percentGroup($type);
}

class GraphPie extends Graph {
  function source() {}
  function percent() {}
  function percentGroup($type) {}
}

```

I realized that should be a common abstract class `Graph` and custom classes as `GraphPie`, `GraphLinear`.

My problem is to create whole structure of classes for this task. For example, need I create another class as `GraphModelClass` where to write methods for retrieve data from db?

In other words I need to build functionality when I retrieve data by schema and can represent this in any graph.

I tried to adopt patterns in my case. I have reviewed patterns like: factory, facade, but it is not fit for me.

I follow this short [instruction](http://campus.murraystate.edu/academic/faculty/wlyle/430/rc008-designpatterns_online.pdf) about using patterns: