You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2016/11/22 02:48:13 UTC

[1/3] incubator-quickstep git commit: add support for LineChart

Repository: incubator-quickstep
Updated Branches:
  refs/heads/viz ddc909fa6 -> bf2323ad3


add support for LineChart


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/4cf26359
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/4cf26359
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/4cf26359

Branch: refs/heads/viz
Commit: 4cf263599db4f2ed3250c9ff037b6b1252b6b0d3
Parents: ddc909f
Author: TianrunLi <ti...@gmail.com>
Authored: Mon Nov 21 16:30:27 2016 -0700
Committer: TianrunLi <ti...@gmail.com>
Committed: Mon Nov 21 16:30:27 2016 -0700

----------------------------------------------------------------------
 viz/configs/LineChart.hpp | 101 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4cf26359/viz/configs/LineChart.hpp
----------------------------------------------------------------------
diff --git a/viz/configs/LineChart.hpp b/viz/configs/LineChart.hpp
new file mode 100644
index 0000000..6080be7
--- /dev/null
+++ b/viz/configs/LineChart.hpp
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ **/
+
+#ifndef QUICKSTEP_VIZ_CONFIGS_LINE_CHART_HPP_
+#define QUICKSTEP_VIZ_CONFIGS_LINE_CHART_HPP_
+
+#include <string>
+#include <map>
+#include <vector>
+
+#include "catalog/CatalogTypedefs.hpp"
+#include "utility/Macros.hpp"
+#include "viz/configs/VizConfig.hpp"
+#include "viz/VizContext.hpp"
+
+#include "json.hpp"
+
+namespace quickstep {
+
+class CatalogRelation;
+class StorageManager;
+
+namespace viz {
+
+/** \addtogroup Viz
+ *  @{
+ */
+
+class LineChart : public VizConfig {
+ public:
+  LineChart(const attribute_id dimension_attr_id,
+            const std::vector<attribute_id> &measure_attr_ids,
+            const VizContextPtr &context)
+      : VizConfig(context),
+        dimension_attr_id_(dimension_attr_id),
+        measure_attr_ids_(measure_attr_ids) {}
+
+  ~LineChart() override {}
+
+  nlohmann::json toJSON() override {
+    std::vector<attribute_id> all_attr_ids;
+    all_attr_ids.emplace_back(dimension_attr_id_);
+    for (const attribute_id id : measure_attr_ids_) {
+      all_attr_ids.emplace_back(id);
+    }
+    nlohmann::json schema = copySchema(all_attr_ids);
+    nlohmann::json columns = nlohmann::json::array();
+    for (std::size_t i = 1; i < all_attr_ids.size(); i++) {
+      std::string header = schema[i]["name"];
+      columns.push_back(copyColumn(all_attr_ids[i], &header));
+    }
+
+    nlohmann::json data;
+    data["columns"] = columns;
+
+    nlohmann::json x_axis;
+    x_axis["x"]["type"] = "category";
+    x_axis["x"]["categories"] = copyColumn(all_attr_ids[0], nullptr);
+
+    nlohmann::json c3;
+    c3["data"] = data;
+    c3["axis"] = x_axis;
+
+    nlohmann::json ret;
+    ret["type"] = "LineChart";
+    ret["trace"] = copyTrace();
+    ret["schema"] = schema;
+    ret["c3"] = c3;
+
+    return ret;
+  }
+
+ private:
+  const attribute_id dimension_attr_id_;
+  const std::vector<attribute_id> measure_attr_ids_;
+
+  DISALLOW_COPY_AND_ASSIGN(LineChart);
+ };
+
+/** @} */
+
+}  // namespace viz
+}  // namespace quickstep
+
+#endif  // QUICKSTEP_VIZ_CONFIGS_LINE_CHART_HPP_


[3/3] incubator-quickstep git commit: Add HeatMap

Posted by ji...@apache.org.
Add HeatMap


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/bf2323ad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/bf2323ad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/bf2323ad

Branch: refs/heads/viz
Commit: bf2323ad3f13d8eaab27dc06bc397710fe1f9ca7
Parents: d010942
Author: Jianqiao Zhu <ji...@cs.wisc.edu>
Authored: Mon Nov 21 20:47:58 2016 -0600
Committer: Jianqiao Zhu <ji...@cs.wisc.edu>
Committed: Mon Nov 21 20:47:58 2016 -0600

----------------------------------------------------------------------
 viz/configs/CMakeLists.txt            |  6 +++
 viz/configs/HeatMap.hpp               | 85 ++++++++++++++++++++++++++++++
 viz/configs/LineChart.hpp             |  1 -
 viz/rules/CMakeLists.txt              |  1 +
 viz/rules/TwoDimensionsOneMeasure.hpp | 11 ++++
 5 files changed, 103 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/bf2323ad/viz/configs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/viz/configs/CMakeLists.txt b/viz/configs/CMakeLists.txt
index ba18424..830fae6 100644
--- a/viz/configs/CMakeLists.txt
+++ b/viz/configs/CMakeLists.txt
@@ -18,6 +18,7 @@
 # Declare micro-libs:
 add_library(quickstep_viz_configs_BarChart ../../empty_src.cpp BarChart.hpp)
 add_library(quickstep_viz_configs_DumpRelation ../../empty_src.cpp DumpRelation.hpp)
+add_library(quickstep_viz_configs_HeatMap ../../empty_src.cpp HeatMap.hpp)
 add_library(quickstep_viz_configs_LineChart ../../empty_src.cpp LineChart.hpp)
 add_library(quickstep_viz_configs_PieChart ../../empty_src.cpp PieChart.hpp)
 add_library(quickstep_viz_configs_StackedAreaTimeSeries ../../empty_src.cpp StackedAreaTimeSeries.hpp)
@@ -38,6 +39,11 @@ target_link_libraries(quickstep_viz_configs_DumpRelation
                       quickstep_viz_VizAnalyzer
                       quickstep_viz_VizContext
                       quickstep_viz_configs_VizConfig)
+target_link_libraries(quickstep_viz_configs_HeatMap
+                      quickstep_catalog_CatalogTypedefs
+                      quickstep_utility_Macros
+                      quickstep_viz_VizContext
+                      quickstep_viz_configs_VizConfig)
 target_link_libraries(quickstep_viz_configs_LineChart
                       quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/bf2323ad/viz/configs/HeatMap.hpp
----------------------------------------------------------------------
diff --git a/viz/configs/HeatMap.hpp b/viz/configs/HeatMap.hpp
new file mode 100644
index 0000000..1f7cbea
--- /dev/null
+++ b/viz/configs/HeatMap.hpp
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ **/
+
+#ifndef QUICKSTEP_VIZ_CONFIGS_HEAT_MAP_HPP_
+#define QUICKSTEP_VIZ_CONFIGS_HEAT_MAP_HPP_
+
+#include "catalog/CatalogTypedefs.hpp"
+#include "utility/Macros.hpp"
+#include "viz/configs/VizConfig.hpp"
+#include "viz/VizContext.hpp"
+
+#include "json.hpp"
+
+namespace quickstep {
+
+class CatalogRelation;
+class StorageManager;
+
+namespace viz {
+
+/** \addtogroup Viz
+ *  @{
+ */
+
+class HeatMap : public VizConfig {
+ public:
+  HeatMap(const attribute_id row_attr_id,
+          const attribute_id col_attr_id,
+          const attribute_id measure_attr_id,
+          const VizContextPtr &context)
+      : VizConfig(context),
+        row_attr_id_(row_attr_id),
+        col_attr_id_(col_attr_id),
+        measure_attr_id_(measure_attr_id) {}
+
+  ~HeatMap() override {}
+
+  nlohmann::json toJSON() override {
+    nlohmann::json columns = nlohmann::json::array();
+    columns.push_back(copyColumn(row_attr_id_));
+    columns.push_back(copyColumn(col_attr_id_));
+    columns.push_back(copyColumn(measure_attr_id_));
+
+    nlohmann::json data;
+    data["columns"] = columns;
+
+    nlohmann::json ret;
+    ret["type"] = "HeatMap";
+    ret["trace"] = copyTrace();
+    ret["schema"] = copySchema({row_attr_id_, col_attr_id_, measure_attr_id_});
+    ret["data"] = data;
+
+    return ret;
+  }
+
+ private:
+  const attribute_id row_attr_id_;
+  const attribute_id col_attr_id_;
+  const attribute_id measure_attr_id_;
+
+  DISALLOW_COPY_AND_ASSIGN(HeatMap);
+ };
+
+/** @} */
+
+}  // namespace viz
+}  // namespace quickstep
+
+#endif  // QUICKSTEP_VIZ_CONFIGS_HEAT_MAP_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/bf2323ad/viz/configs/LineChart.hpp
----------------------------------------------------------------------
diff --git a/viz/configs/LineChart.hpp b/viz/configs/LineChart.hpp
index 6080be7..d1055eb 100644
--- a/viz/configs/LineChart.hpp
+++ b/viz/configs/LineChart.hpp
@@ -21,7 +21,6 @@
 #define QUICKSTEP_VIZ_CONFIGS_LINE_CHART_HPP_
 
 #include <string>
-#include <map>
 #include <vector>
 
 #include "catalog/CatalogTypedefs.hpp"

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/bf2323ad/viz/rules/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/viz/rules/CMakeLists.txt b/viz/rules/CMakeLists.txt
index b644e65..a95be48 100644
--- a/viz/rules/CMakeLists.txt
+++ b/viz/rules/CMakeLists.txt
@@ -62,6 +62,7 @@ target_link_libraries(quickstep_viz_rules_TwoDimensionsOneMeasure
                       quickstep_viz_VizAnalyzer
                       quickstep_viz_VizContext
                       quickstep_viz_VizObject
+                      quickstep_viz_configs_HeatMap
                       quickstep_viz_configs_StackedAreaTimeSeries
                       quickstep_viz_configs_TimeSeries)
 target_link_libraries(quickstep_viz_rules_VizRule

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/bf2323ad/viz/rules/TwoDimensionsOneMeasure.hpp
----------------------------------------------------------------------
diff --git a/viz/rules/TwoDimensionsOneMeasure.hpp b/viz/rules/TwoDimensionsOneMeasure.hpp
index 07f8fc8..7217b70 100644
--- a/viz/rules/TwoDimensionsOneMeasure.hpp
+++ b/viz/rules/TwoDimensionsOneMeasure.hpp
@@ -25,6 +25,7 @@
 #include "viz/VizAnalyzer.hpp"
 #include "viz/VizContext.hpp"
 #include "viz/VizObject.hpp"
+#include "viz/configs/HeatMap.hpp"
 #include "viz/configs/StackedAreaTimeSeries.hpp"
 #include "viz/configs/TimeSeries.hpp"
 
@@ -57,6 +58,8 @@ class TwoDimensionsOneMeasure : public VizRule {
 
     const VizContextPtr new_context_ptr(new_context.release());
 
+    // TODO: check columns statistics.
+
     // Try TimeseriesChart
     const VizAnalyzer *analyzer =
         context_->get<VizAnalyzer>("VizAnalyzer");
@@ -80,6 +83,14 @@ class TwoDimensionsOneMeasure : public VizRule {
                                         new_context_ptr));
       }
     }
+
+    // HeatMap
+    for (std::size_t i = 0; i < 2uL; ++i) {
+        yield(new HeatMap(dimension_attr_ids.at(i),
+                          dimension_attr_ids.at(1-i),
+                          measures->getAttributeIds().front(),
+                          new_context_ptr));
+    }
   }
 
  private:


[2/3] incubator-quickstep git commit: update OneDImensionMultiMeasures for LineChart

Posted by ji...@apache.org.
update OneDImensionMultiMeasures for LineChart


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/d0109421
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/d0109421
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/d0109421

Branch: refs/heads/viz
Commit: d0109421b1684f0af912400fd19e9e53a2e5d89d
Parents: 4cf2635
Author: TianrunLi <ti...@gmail.com>
Authored: Mon Nov 21 16:31:02 2016 -0700
Committer: TianrunLi <ti...@gmail.com>
Committed: Mon Nov 21 16:31:02 2016 -0700

----------------------------------------------------------------------
 viz/configs/CMakeLists.txt              |  6 ++++++
 viz/rules/CMakeLists.txt                |  4 +++-
 viz/rules/OneDimensionMultiMeasures.hpp | 20 +++++---------------
 3 files changed, 14 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d0109421/viz/configs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/viz/configs/CMakeLists.txt b/viz/configs/CMakeLists.txt
index f580bfb..ba18424 100644
--- a/viz/configs/CMakeLists.txt
+++ b/viz/configs/CMakeLists.txt
@@ -18,6 +18,7 @@
 # Declare micro-libs:
 add_library(quickstep_viz_configs_BarChart ../../empty_src.cpp BarChart.hpp)
 add_library(quickstep_viz_configs_DumpRelation ../../empty_src.cpp DumpRelation.hpp)
+add_library(quickstep_viz_configs_LineChart ../../empty_src.cpp LineChart.hpp)
 add_library(quickstep_viz_configs_PieChart ../../empty_src.cpp PieChart.hpp)
 add_library(quickstep_viz_configs_StackedAreaTimeSeries ../../empty_src.cpp StackedAreaTimeSeries.hpp)
 add_library(quickstep_viz_configs_TimeSeries ../../empty_src.cpp TimeSeries.hpp)
@@ -37,6 +38,11 @@ target_link_libraries(quickstep_viz_configs_DumpRelation
                       quickstep_viz_VizAnalyzer
                       quickstep_viz_VizContext
                       quickstep_viz_configs_VizConfig)
+target_link_libraries(quickstep_viz_configs_LineChart
+                      quickstep_catalog_CatalogTypedefs
+                      quickstep_utility_Macros
+                      quickstep_viz_VizContext
+                      quickstep_viz_configs_VizConfig)
 target_link_libraries(quickstep_viz_configs_PieChart
                       quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d0109421/viz/rules/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/viz/rules/CMakeLists.txt b/viz/rules/CMakeLists.txt
index 8366104..b644e65 100644
--- a/viz/rules/CMakeLists.txt
+++ b/viz/rules/CMakeLists.txt
@@ -44,7 +44,9 @@ target_link_libraries(quickstep_viz_rules_OneDimensionMultiMeasures
                       quickstep_viz_VizAnalyzer
                       quickstep_viz_VizContext
                       quickstep_viz_VizObject
-                      quickstep_viz_configs_BarChart)
+                      quickstep_viz_configs_BarChart
+                      quickstep_viz_configs_LineChart
+                      )
 target_link_libraries(quickstep_viz_rules_OneDimensionOneMeasure
                       quickstep_catalog_CatalogTypedefs
                       quickstep_utility_Macros

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d0109421/viz/rules/OneDimensionMultiMeasures.hpp
----------------------------------------------------------------------
diff --git a/viz/rules/OneDimensionMultiMeasures.hpp b/viz/rules/OneDimensionMultiMeasures.hpp
index 4e0fc9f..d2f0fd4 100644
--- a/viz/rules/OneDimensionMultiMeasures.hpp
+++ b/viz/rules/OneDimensionMultiMeasures.hpp
@@ -26,6 +26,7 @@
 #include "viz/VizContext.hpp"
 #include "viz/VizObject.hpp"
 #include "viz/configs/BarChart.hpp"
+#include "viz/configs/LineChart.hpp"
 
 namespace quickstep {
 namespace viz {
@@ -59,21 +60,10 @@ class OneDimensionMultiMeasures : public VizRule {
                        measures->getAttributeIds(),
                        new_context_ptr));
 
-    /*
-    // Try TimeseriesChart
-    const VizAnalyzer *analyzer =
-        context_->get<VizAnalyzer>("VizAnalyzer");
-    const attribute_id dimension_attr_id = dimensions->getAttributeIds().front();
-
-    std::string time_format;
-    if (analyzer->isTime(dimension_attr_id, &time_format)) {
-      yield(new TimeSeries(dimension_attr_id,
-                           time_format,
-                           kInvalidAttributeID,
-                           measures->getAttributeIds().front(),
-                           new_context_ptr));
-    }
-    */
+    // LineChart
+    yield(new LineChart(dimensions->getAttributeIds().front(),
+                       measures->getAttributeIds(),
+                       new_context_ptr));
   }
 
  private: