This is an example of my firms costum made chart with connected table.
UPDATE my full idea
i have been given this alot of thinking since i started this post and i have finally come up with an idea that i think is solid using the Builder pattern i want to you guys what you think and what issues you think that i might run into. First let me explain the full idea:
My Company need some sort of Standard graph with a connected table that they can use for all of their programs (This will give the programs a feeling that they are all alike (which they are)) Since most of these charts are alike i thought i could easy the pain of creating a new chart every time you have to make a new program or have to place the chart somewhere else.
My Company use three diffrent charts primarily:
- Barchart
- LineChart
- PieChart
When creating these charts there are a few unknown variables.
Name of the chart series: This is the name that will be display and this differs from every line/bar/ pie slice
Period: Chart data is taken from a period of time, either a day or a week (every day Monday, Tuesday, Wednesday etc) a month (Jan,Feb,mar,April etc) or even time of day.(8pm,9pm etc).
Type of chart: of-course a difference is what type of chart the user wants to see.
Last but not least the only difference between the chart creating lies within the Piechart, the pieChart is the only chart in Javafx that is not created from series but is created from an Observable list, so the pieChartBuilder has to use and insert the data in a different way than the others.
The picture above is Not an UML diagram it is a demonstration of how i plan my new program(s) to behave and adjust the design pattern, here is a walk through of what my thought are:
GUI: First the Gui is always separated from the actual logic i have no plans of demanding anything from the GUI except that it has to created in JavaFx and it has to have an instance of the Director class.
Director: The Director class is where all the action happens. First the client calls the director with what type of chart he wants to get, what period of time he wants data from and maybe what kind of data he wants to see. The client also sets the time period that he wishes to see the data in (day, week, month , year etc).
The Director then takes all of that data and class his instance of the statistic class asking the class for data that the director can then pass on the the Chart builder.
Statistics: the statistics class then checks if it already contains data and if not it class for a list of object to the database:
DataBase: The database is quite straight forward it class for the data in the time period that client has send on (either on a day, week, month, year basis) creates the object(s) add them to a list and return it to the statistics class.
(back in the) statistic class the objects data are then calculated and returned to the director.
(Back in the director) The director now calls the chartBuilder to build a chart of the type specified by the client with the timeframe (which is an array or an arraylist of time, This is an option the client can set in the director using
Director.setStandardTime(time)
) the builder then creates the chart and table with the data obtained from the Director. The client is then able to call ChartBuilder.getChart() and add that to his layout.
This is my idea. i Would love for you to comment on it. Thank you for reading and i will be looking forward to read all of your responses.