数据源

准备原始数据

2份原始模拟数据源的链接可在此下载:点我点我 使用sqliteBrower打开db.

元数据:

db4469e0e6bb480dbd08fe00db878292

教师指标截图

各列字段代表的意义:

COL_0_0:Subject
COL_0_1:Year
COL_0_2:Term
COL_0_3:Month
COL_0_4:Day
COL_0_5:Grade
COL_0_6:Class
COL_0_7:Teacher
COL_0_8:Teacher's Session Duration
COL_0_9:Teacher's case count
COL_0_10:Student's case count of Done
COL_0_11:Student's case count of Correct

元数据:

499a4c557cc34b94ab7e33de202ae527

学生指标截图

各列字段代表的意义:

COL_0_0:Subject
COL_0_1:Year
COL_0_2:Term
COL_0_3:Month
COL_0_4:Day
COL_0_5:Grade
COL_0_6:Class
COL_0_7:Student
COL_0_8:Student's Performance
COL_0_9:Student's Total Quantity of Homework
COL_0_10:Student's Doen Quantity of Homework

定义多维结构

将多维数据源的结构以json定义:


[
        {
            "dataSetId": "abaa7259-9a26-4210-b3d8-ca7f0b7bebe8",
            "dimensions": [
                {
                    "granularities": [
                        {
                            "key": "COL_0_0",
                            "title": "Subject"
                        }
                    ],
                    "key": "Dimension_1",
                    "title": "Subject"
                },
                {
                    "granularities": [
                        {
                            "key": "COL_0_1",
                            "title": "Year"
                        },
                        {
                            "key": "COL_0_2",
                            "sort": "NXSortOperationAsc",
                            "title": "Term"
                        },
                        {
                            "key": "COL_0_3",
                            "title": "Month"
                        },
                        {
                            "key": "COL_0_4",
                            "title": "Day"
                        }
                    ],
                    "key": "Dimension_2",
                    "title": "Time"
                },
                {
                    "granularities": [
                        {
                            "key": "COL_0_5",
                            "title": "Grade"
                        },
                        {
                            "key": "COL_0_6",
                            "title": "Class"
                        },
                        {
                            "key": "COL_0_7",
                            "title": "Teacher"
                        }
                    ],
                    "key": "Dimension_3",
                    "title": "Unit"
                }
            ],
            "measures": [
                {
                    "key": "COL_0_8",
                    "title": "Teacher's Session Duration"
                },
                {
                    "key": "COL_0_9",
                    "title": "Teacher's case count"
                },
                {
                    "key": "COL_0_10",
                    "title": "Student's case count of Done"
                },
                {
                    "key": "COL_0_11",
                    "title": "Student's case count of Correct"
                }
            ]
        },
        {
            "dataSetId": "842e1994-dad5-4914-829b-5a12799db135",
            "dimensions": [
                {
                    "granularities": [
                        {
                            "key": "COL_0_0",
                            "title": "Subject"
                        }
                    ],
                    "key": "Dimension_1",
                    "title": "Subject"
                },
                {
                    "granularities": [
                        {
                            "key": "COL_0_1",
                            "title": "Year"
                        },
                        {
                            "key": "COL_0_2",
                            "sort": "NXSortOperationAsc",
                            "title": "Term"
                        },
                        {
                            "key": "COL_0_3",
                            "title": "Month"
                        },
                        {
                            "key": "COL_0_4",
                            "title": "Day"
                        }
                    ],
                    "key": "Dimension_2",
                    "title": "Time"
                },
                {
                    "granularities": [
                        {
                            "key": "COL_0_5",
                            "title": "Grade"
                        },
                        {
                            "key": "COL_0_6",
                            "title": "Class"
                        },
                        {
                            "key": "COL_0_7",
                            "title": "Student"
                        }
                    ],
                    "key": "Dimension_3",
                    "title": "Unit"
                }
            ],
            "measures": [
                {
                    "key": "COL_0_8",
                    "title": "Student's Performance"
                },
                {
                    "key": "COL_0_9",
                    "title": "Student's Total Quantity of Homework"
                },
                {
                    "key": "COL_0_10",
                    "title": "Student's Doen Quantity of Homework"
                }
            ]
        }
    ]

维粒度设定解析
sort:将该粒度的数据进行相应的排序操作。可选项有:NXSortOperationNone(不排序),NXSortOperationAsc(增序),NXSortOperationDesc(降序)

使用服务器生成多维数据db

将上面的json转化为NXCubeStructure,并生成多层级的sqlitedb.此处源数据从sqlite里读的,因此使用NXProducerSQLiteDataSource. 若源数据从mysql,oracle读的,使用相应的NXProducerMysqlDataSource,NXProducerOracleDataSource。

NXCubeStructure cube=NXCubeStructure.fill("json structure string abrove"); NXProducerSQLiteDataSource productor = new NXProducerSQLiteDataSource(){ @Override public String getTargetDatabaseFolderPath() { return "db file generate path folder"; } }; productor.createCube("datasetid", cube.getDataSetId(), cube.getDimensions(), cube.getMeasures(), cube.getEncrypt());

接下来需要定义图表配置文件。 点我跳转

results matching ""

    No results matching ""