quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jianq...@apache.org
Subject [3/3] incubator-quickstep git commit: Add HeatMap
Date Tue, 22 Nov 2016 02:48:15 GMT
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 <jianqiao@cs.wisc.edu>
Authored: Mon Nov 21 20:47:58 2016 -0600
Committer: Jianqiao Zhu <jianqiao@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:


Mime
View raw message