Esempio n. 1
0
        private int[] getXCounts()
        {
            ChartViewHelper chartViewHelper = new ChartViewHelper();

            int[] xCounts = chartViewHelper.GetXCounts();

            return(xCounts);
        }
Esempio n. 2
0
        private Color[] generateColors()
        {
            ChartViewHelper chartViewHelper = new ChartViewHelper();

            Color[] colors = chartViewHelper.GenerateColors();

            return(colors);
        }
        private List <TemplateInfo> getTemplateInfos(string module)
        {
            List <TemplateInfo> templateInfos = new List <TemplateInfo>();

            ChartViewHelper chartViewHelper = new ChartViewHelper();

            templateInfos = chartViewHelper.GetTemplateInfos(module);

            return(templateInfos);
        }
Esempio n. 4
0
        private string convertToChartDataType(string dataType)
        {
            string chartDataType = string.Empty;

            ChartViewHelper chartViewHelper = new ChartViewHelper();

            chartDataType = chartViewHelper.ConvertToChartDataType(dataType);

            return(chartDataType);
        }
        private string getFullTemplateFileName(string module)
        {
            string fullName = string.Empty;

            setTemplatePath();

            ChartViewHelper chartViewHelper = new ChartViewHelper();

            fullName = chartViewHelper.GetFullTemplateFileName(module);

            return(fullName);
        }
        private void setTemplatePath()
        {
            ChartViewHelper chartViewHelper = new ChartViewHelper();
            string          path            = chartViewHelper.GetFullPath();

            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// <see cref="MB.WinBase.IFace.CreateDataBinding"/>
        /// </summary>
        public void CreateDataBinding(IClientRuleConfig clientRule, DataSet dsData)
        {
            try
            {
                _DataSet = dsData;

                bool notNullDataSource = judgeIsNullDataSource(clientRule, dsData);

                if (notNullDataSource)
                {
                    List <ColumnPropertyInfo> columnPropertyInfos = getColumnPropertyInfo(clientRule);
                    _ColumnPropertyInfos = columnPropertyInfos;

                    string identity = getIdentity(clientRule);
                    _Identity = identity;

                    if (null != _DefaultChartType)
                    {
                        bindDefaultChart(_DefaultChartType, dsData.Tables[0].Columns, _PagerSettings);
                    }
                    else
                    {
                        ChartViewHelper chartViewHelper = new ChartViewHelper();

                        ChartEventArgs chartEventArgs = new ChartEventArgs();
                        chartEventArgs.ChartType = SeriesChartType.Pie;
                        _ChartEventArgs          = chartEventArgs;

                        List <ChartAreaInfo> chartAreaInfos = chartViewHelper.CreateChartData(dsData, columnPropertyInfos, chartEventArgs, _PagerSettings);

                        _XValueCount             = chartViewHelper.XValueCount;
                        _PagerSettings.PageIndex = 0;
                        _PagerSettings.PageCount = _XValueCount / _PagerSettings.PageSize + 1;
                        showBindingNavigator(_PagerSettings);

                        IChart chart = new PieChart(_BaseChart);
                        chart.AreaDataList = chartAreaInfos;
                    }

                    setNavigationStatus(true);
                    setPageButton();
                }
                else
                {
                    setNavigationStatus(false);
                }
            }
            catch (Exception ex)
            {
                MB.WinBase.ApplicationExceptionTerminate.DefaultInstance.ExceptionTerminate(ex);
            }
        }
Esempio n. 8
0
        ///// <summary>
        /////  把数据实体集合类转换为 客户可分析DataSet 的格式。
        ///// </summary>
        ///// <param name="entitys">数据实体集.</param>
        ///// <param name="propertys">可配制的属性.</param>
        ///// <param name="columnsEdit">编辑属性.</param>
        ///// <returns>转化后的DataSet.</returns>
        //public DataSet ConvertEntityToDataSet(System.Collections.IList entitys,
        //    Dictionary<string, ColumnPropertyInfo> propertys, Dictionary<string, ColumnEditCfgInfo> columnsEdit,)
        //{
        //    if (entitys == null || propertys == null) return null;
        //    _EditDataHasTable = new Dictionary<string, Dictionary<string, string>>();
        //    try
        //    {
        //        DataTable dtData = new DataTable();
        //        List<ColumnPropertyInfo> filterColumnPropertyInfos = new List<ColumnPropertyInfo>();

        //        foreach (ColumnPropertyInfo info in propertys.Values)
        //        {
        //            if (!string.IsNullOrEmpty(info.ChartDataType))
        //            {
        //                if (null != entitys && 0 != entitys.Count)
        //                {
        //                    if (MB.Util.MyReflection.Instance.CheckObjectExistsProperty(entitys[0], info.Name))
        //                    {
        //                        string dataType = info.DataType;
        //                        if (columnsEdit != null && columnsEdit.ContainsKey(info.Name))
        //                            dataType = ChartViewStatic.SYSTEM_STRING;

        //                        dtData.Columns.Add(info.Name, MB.Util.General.CreateSystemType(dataType, false));

        //                        filterColumnPropertyInfos.Add(info);
        //                    }
        //                }
        //            }
        //        }

        //        Type t = entitys[0].GetType();
        //        foreach (object entity in entitys)
        //        {
        //            DataRow drNew = dtData.NewRow();
        //            dtData.Rows.Add(drNew);
        //            foreach (ColumnPropertyInfo info in filterColumnPropertyInfos)
        //            {
        //                var v = t.GetProperty(info.Name);
        //                object val = v.GetValue(entity, null);

        //                if (val == null || val == System.DBNull.Value) continue;

        //                if (columnsEdit != null && columnsEdit.ContainsKey(info.Name))
        //                {
        //                    drNew[info.Name] = convertValueToDescription(val, columnsEdit[info.Name]);
        //                }
        //                else
        //                {
        //                    drNew[info.Name] = MB.Util.MyConvert.Instance.ChangeType(val, dtData.Columns[info.Name].DataType);
        //                }
        //            }
        //        }

        //        DataSet dsData = new DataSet();
        //        dsData.Tables.Add(dtData);
        //        return dsData;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new MB.Util.APPException("执行 ConvertEntityToDataSet 出错" + ex.Message);
        //    }
        //}

        #region Add private method


        #endregion

        #endregion

        #region private methods

        private void bindDefaultChart(ChartTypeInfo chartTypeInfo, DataColumnCollection dataColumnCollection,
                                      PagerSettings pagerSettings)
        {
            ChartEventArgs chartEventArgs = new ChartEventArgs();

            ChartViewHelper chartViewHelper = new ChartViewHelper();

            chartEventArgs.ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), chartTypeInfo.DefaultChartType.ToString());
            chartEventArgs.XAxis     = chartViewHelper.GetDataColumn(chartTypeInfo.XAxis, dataColumnCollection);
            chartEventArgs.YAxis     = chartViewHelper.GetDataColumn(chartTypeInfo.YAxis, dataColumnCollection);
            chartEventArgs.ZAxis     = chartViewHelper.GetDataColumn(chartTypeInfo.ZAxis, dataColumnCollection);

            prepareChart(chartEventArgs, pagerSettings);
        }
Esempio n. 9
0
        private void prepareChart(ChartEventArgs e, PagerSettings pagerSettings)
        {
            ChartViewHelper chartViewHelper = new ChartViewHelper();

            List <ChartAreaInfo> chartAreaInfos = chartViewHelper.CreateChartData(
                _DataSet, _ColumnPropertyInfos, e, pagerSettings);

            _XValueCount            = chartViewHelper.XValueCount;
            pagerSettings.PageCount = _XValueCount / pagerSettings.PageSize + 1;
            showBindingNavigator(_PagerSettings);

            if (e.ChartType == SeriesChartType.Pie)
            {
                using (IChart chart = new PieChart(_BaseChart))
                {
                    chart.IsPercent    = e.IsPercent;
                    chart.AreaDataList = chartAreaInfos;
                }
            }

            bool isMultiChartArea = false;

            if (e.AnalyseData == ChartViewStatic.R_BTN_COMPARE_NAME)
            {
                isMultiChartArea = true;
            }

            if (e.ChartType == SeriesChartType.Line)
            {
                using (IChart chart = new LineChart(_BaseChart, e.NeedSortXAxis, isMultiChartArea))
                {
                    chart.IsPercent    = e.IsPercent;
                    chart.AreaDataList = chartAreaInfos;
                }
            }

            if (e.ChartType == SeriesChartType.Column)
            {
                using (IChart chart = new ColumnChart(_BaseChart, e.NeedSortXAxis, isMultiChartArea))
                {
                    chart.IsPercent    = e.IsPercent;
                    chart.AreaDataList = chartAreaInfos;
                }
            }

            _ChartEventArgs = e;
        }