NotionCommotion Posted July 31, 2016 Share Posted July 31, 2016 (edited) I am building a Highcharts configuration tool where the resultant options object is stored as JSON in a text database column (I will not be supporting functions in the options object, so JSON will work). I will have a page which will display various properties of a given chart such as the type of chart, its title, the legend names, etc. I am thinking of not storing any of the properties in a separate column of the table, but just using json_decode() to get the values. "If" I need to create a list of all Pie charts, Bar charts, etc, I will store the chart type as a separate column and duplicate the data. Any concerns? Thanks { "chart": { "plotBackgroundColor": null, "plotBorderWidth": null, "plotShadow": false, "type": "pie" }, "title": { "text": "Browser market shares January, 2015 to May, 2015" }, "tooltip": { "pointFormat": "{series.name}: <b>{point.percentage:.1f}%</b>" }, "plotOptions": { "pie": { "allowPointSelect": true, "cursor": "pointer", "dataLabels": { "enabled": true, "format": "<b>{point.name}</b>: {point.percentage:.1f} %", "style": { "color": "black" } } } }, "series": [ { "name": "Brands", "colorByPoint": true, "data": [ { "name": "Microsoft Internet Explorer", "y": 56.33 }, { "name": "Chrome", "y": 24.03, "sliced": true, "selected": true }, { "name": "Firefox", "y": 10.38 }, { "name": "Safari", "y": 4.77 }, { "name": "Opera", "y": 0.91 }, { "name": "Proprietary or Undetectable", "y": 0.2 } ] } ] } Edited July 31, 2016 by NotionCommotion Quote Link to comment Share on other sites More sharing options...
.josh Posted July 31, 2016 Share Posted July 31, 2016 If you are absolutely, positively, 100% sure you will not ever need to actually do any queries to return data sets based off stuff within there, then it shouldn't be an issue Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted July 31, 2016 Author Share Posted July 31, 2016 If you are absolutely, positively, 100% sure you will not ever need to actually do any queries to return data sets based off stuff within there, then it shouldn't be an issue Thanks Josh, Not today, but maybe one day, and if so, I will parse the text and duplicate the appropriate data in its own column. I didn't originally say so, but the data (i.e. {"name": "Microsoft Internet Explorer","y": 56.33}) will not be stored in the file as it comes from a different source. Instead of hard coding a value of 56.33, maybe it will store the primary key of a record? But then if that record got deleted, I wouldn't have any foreign key constraint. Instead, maybe I should exclude this data from the JSON and store it in a database? Or maybe keep it both places; the JSON for the legend name and order (and any other Highchart features which are only display oriented), and the database for foreign key constraints only? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.