Example #1
0
 public static ChartPanel CreateChartDescriptor(ChartTypesEnum chartType)
 {
     return DataPortal.Fetch<ChartPanel>(chartType);
 }
Example #2
0
 public static Task<ChartPanel> CreateChartDescriptorAsync(ChartTypesEnum chartType)
 {
     return DataPortal.FetchAsync<ChartPanel>(chartType);
 }
Example #3
0
 public static void CreateCharts(ChartPanel parentPanel, ChartTypesEnum chartType)
 {
     parentPanel.SetSilently(ChartPanel.ChartsProperty, DataPortal.FetchChild<ChartCollection>());
     parentPanel.Charts.PopulateCollection(chartType);
 }
 public static Task<ChartPanel> GetSampleDataForSPCAsync(IEditableRoot instance, string spcFieldName, ChartTypesEnum chartType, ChartPanel chartDescriptor, bool isForExpressions)
 {
     return TaskHelper.FromResult(chartDescriptor);
 }
        private static ChartPanel GetChartDescriptor(IEditableRoot instance, string exprFieldName, string spcFieldName, ChartTypesEnum chartType, int subgroupSize, int dataPoints = 0)
        {
            ChartPanel chartDescriptor = null;

            MobileDictionary<string, ChartPanel> dict = null;
            if (!exprFieldName.Contains("_Rule"))
            {
                dict = instance.GetValueByPropertyName("ChartDescriptorExp") as MobileDictionary<string, ChartPanel>;
                if (dict != null)
                    dict.TryGetValue(string.Format("{0}{1}", exprFieldName, spcFieldName), out chartDescriptor);
                else
                    dict = new MobileDictionary<string, ChartPanel>();
            }

            if (chartDescriptor == null)
            {
                chartDescriptor = SpcManager.CreateChartDescriptor(chartType);
                chartDescriptor.DataPoints = dataPoints;
                chartDescriptor.SubgroupSize = subgroupSize;

                chartDescriptor = MethodCaller.CallFactoryMethod(instance.GetType(), "GetSampleDataForSPC", spcFieldName, instance, chartType, chartDescriptor, true) as ChartPanel;

                if (!exprFieldName.Contains("_Rule"))
                {
                    ChartPanel chartPanel;
                    if (dict.TryGetValue(string.Format("{0}{1}", exprFieldName, spcFieldName), out chartPanel))
                        dict[string.Format("{0}{1}", exprFieldName, spcFieldName)] = chartDescriptor;
                    else
                        dict.Add(string.Format("{0}{1}", exprFieldName, spcFieldName), chartDescriptor);

                    instance.LoadValueByPropertyName("ChartDescriptorExp", dict);
                }
            }
            else
            {
                chartDescriptor.DataPoints = dataPoints;
                chartDescriptor.SubgroupSize = subgroupSize;

                chartDescriptor = MethodCaller.CallFactoryMethod(instance.GetType(), "GetSampleDataForSPC", spcFieldName, instance, chartType, chartDescriptor, true) as ChartPanel;
            }

            return chartDescriptor;
        }        
        private static Task<ChartPanel> GetChartDescriptorAsync(IEditableRoot instance, string exprFieldName, string spcFieldName, ChartTypesEnum chartType, int subgroupSize, int dataPoints = 0)
        {
            ChartPanel chartDescriptor = null;

            var dict = instance.GetValueByPropertyName("ChartDescriptorExp") as MobileDictionary<string, ChartPanel>;
            if (dict != null)
                dict.TryGetValue(string.Format("{0}{1}", exprFieldName, spcFieldName), out chartDescriptor);
            else
                dict = new MobileDictionary<string, ChartPanel>();

            if (chartDescriptor == null)
            {
                return SpcManager.CreateChartDescriptorAsync(chartType)
                    .ContinueWith(async task =>
                    {
                        if (task.Result != null)
                        {
                            chartDescriptor = task.Result;
                            chartDescriptor.DataPoints = dataPoints;
                            chartDescriptor.SubgroupSize = subgroupSize;

                            var getDataTask = MethodCaller.CallFactoryMethod(
                                instance.GetType(), "GetSampleDataForSPCAsync", instance, spcFieldName, chartType, chartDescriptor, true) as Task<ChartPanel>;
                            chartDescriptor = await getDataTask;

                            ChartPanel chartPanel;
                            if (dict.TryGetValue(string.Format("{0}{1}", exprFieldName, spcFieldName), out chartPanel))
                                dict[string.Format("{0}{1}", exprFieldName, spcFieldName)] = chartDescriptor;
                            else
                                dict.Add(string.Format("{0}{1}", exprFieldName, spcFieldName), chartDescriptor);

                            instance.LoadValueByPropertyName("ChartDescriptorExp", dict);

                            return chartDescriptor;
                        }

                        return task.Result;
                    }
                    , CancellationToken.None, TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()).Unwrap();
            }

            chartDescriptor.DataPoints = dataPoints;
            chartDescriptor.SubgroupSize = subgroupSize;

            var getSamplesTask = MethodCaller.CallFactoryMethod(
                instance.GetType(), "GetSampleDataForSPCAsync", instance, spcFieldName, chartType, chartDescriptor, true) as Task<ChartPanel>;
            return getSamplesTask;
        }
Example #7
0
 /// <summary>
 /// Froms the type of the chart base chart.
 /// </summary>
 /// <param name="chartTypesEnum">The chart types enum.</param>
 /// <returns>ChartSeriesType.</returns>
 private ChartSeriesType fromChartBaseChartType(ChartTypesEnum chartTypesEnum)
 {
     //TODO
     //switch (chartTypesEnum)
     //{
     //    case ChartTypesEnum.XBarChart:
     //        return ChartSeriesType.Bar;
     //}
     return ChartSeriesType.Area;
 }