Esempio n. 1
0
        public ChartExportDTO ExportChartToJpg(ChartTableDTO zippedData, object syncLock)
        {
            Utils.CheckNotNull(zippedData, "zippedData");
            if (m_ChartDetail == null)
            {
                throw new AvrException("Chart already disposed.");
            }

            BaseTableDTO unzippedData = BinaryCompressor.Unzip(zippedData);
            DataTable    data         = BinarySerializer.DeserializeToTable(unzippedData);

            if (zippedData.TextPatterns != null)
            {
                foreach (string col in zippedData.TextPatterns.Keys)
                {
                    data.Columns[col].ExtendedProperties.Add("TextPattern", zippedData.TextPatterns[col]);
                }
            }

            ChartExportDTO result;

            lock (syncLock)
            {
                m_ChartDetail.DataSource = data;
                object id = zippedData.ViewId;

                m_ChartDetail.LoadData(ref id);

                m_ChartDetail.ChartControlSize = new Size(zippedData.Width, zippedData.Height);
                result = m_ChartDetail.ExportToJpgBytes(zippedData.ChartSettings, zippedData.ChartType);
            }
            return(result);
        }
Esempio n. 2
0
        public ChartExportDTO ExportToJpgBytes(long viewId, int width, int height)
        {
            using (var chartForm = new ChartDetailForm())
            {
                chartForm.Size       = new Size(width, height);
                chartForm.DataSource = CreateChartData();
                object id = viewId;
                chartForm.LoadData(ref id);
                chartForm.ChartControlSize = new Size(width, height);

                ChartExportDTO export = chartForm.ExportToJpgBytes(new byte[0], DBChartType.chrBar);
                return(export);
            }
        }