WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Excel Chart mit 2 X-achse

 

Freimann
Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 09.09.14
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 24.11.2014, 01:35     Titel: Excel Chart mit 2 X-achse
  Antworten mit Zitat      
Ich möchte ein Programm machen, das ein Excel Chart mit 2 X-achse und ein Y-achse mache.
wie kann ich zweit X-achse hinzufügen?

hier ist mein code
Code:

Excel = actxserver('excel.application');
% Get Workbook object
WB = Excel.Workbooks.Open(outname);
% Get neu Worksheets object
WS = WB.Worksheets;
WS.Add([], WS.Item(WS.Count));
           
Sheet=WB.Worksheets.Item('Sheet2');
Charts = WB.Charts;
Chart = invoke(Charts,'Add');
invoke(Excel.ActiveChart.SeriesCollection,'NewSeries');
Excel.ActiveChart.SeriesCollection(1).Name = 'Temberatur';
Excel.ActiveChart.SeriesCollection(1).XValues = Sheet.Range(strcat('B3:B',num2str(C)));
Excel.ActiveChart.SeriesCollection(1).Values = Sheet.Range(strcat('A3:A',num2str(C)));
 % Setting the Chart Sheet Title & Chart Title.
Excel.ActiveChart.HasTitle = 1;
Excel.ActiveChart.ChartTitle.Characters.Text = 'Temperatur';
Excel.ActiveChart.Name = 'Temperatur';
% Setting the (X-Axis) and (Y-Axis) titles.
ChartAxes = invoke(Chart,'Axes',1);
set(ChartAxes,'HasTitle',1);
set(ChartAxes.AxisTitle,'Caption','Temperatur /°C');
ChartAxes = invoke(Chart,'Axes',2);
set(ChartAxes,'HasTitle',2);
set(ChartAxes.AxisTitle,'Caption','Tiefe /m');
Excel.ActiveChart.ChartType = 65;
% Setting the (Y-Axis) Scale
Excel.ActiveChart.Axes(2).Select;
Excel.ActiveChart.Axes(2).MinimumScale = 0;            
Excel.ActiveChart.Axes(2).MaximumScale = max(handles.tiefe(:,C));
Excel.ActiveChart.Axes(2).ReversePlotOrder = true;
 
Private Nachricht senden Benutzer-Profile anzeigen


Freimann
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 17
Anmeldedatum: 09.09.14
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 28.11.2014, 04:57     Titel:
  Antworten mit Zitat      
ich habe die Lösung gefunden
mit
Code:

Excel.ActiveChart.ChartType = 65;
 

kann man nicht 2 X-achse machen. ich hab das mit ChartType = 73 und hat sehr gut geklappt
hier die liste für ChartTyp
http://it.toolbox.com/wiki/index.php/EXCEL_Chart_Type_Enumeration

hier ist mein end Code
Code:

   Excel = actxserver('excel.application');
    % Get Workbook object
    WB = Excel.Workbooks.Open(outname);
    % Get neu Worksheets object
    WS = WB.Worksheets;
    WS.Add([], WS.Item(WS.Count));
    Sheet=WB.Worksheets.Item('Ergebnis');
    Charts = WB.Charts;
    Chart = invoke(Charts,'Add');
    invoke(Excel.ActiveChart.SeriesCollection,'NewSeries');
    Excel.ActiveChart.SeriesCollection(1).Name = 'Temperatur der Erdr';
    Excel.ActiveChart.SeriesCollection(1).XValues = Sheet.Range(strcat('B3:B',num2str(C)));
    Excel.ActiveChart.SeriesCollection(1).Values = Sheet.Range(strcat('A3:A',num2str(C)));
    invoke(Excel.ActiveChart.SeriesCollection,'NewSeries');
    Excel.ActiveChart.SeriesCollection(2).Name = 'Temperatur der CO2';
    Excel.ActiveChart.SeriesCollection(2).XValues = Sheet.Range(strcat('C3:C',num2str(C)));
    Excel.ActiveChart.SeriesCollection(2).Values = Sheet.Range(strcat('A3:A',num2str(C)));
    invoke(Excel.ActiveChart.SeriesCollection,'NewSeries');
    Excel.ActiveChart.SeriesCollection(3).Name = 'Temperatur der Wand';
    Excel.ActiveChart.SeriesCollection(3).XValues = Sheet.Range(strcat('I3:I',num2str(C)));
    Excel.ActiveChart.SeriesCollection(3).Values = Sheet.Range(strcat('A3:A',num2str(C)));
    % Setting the Chart Sheet Title & Chart Title.
    Excel.ActiveChart.HasTitle = 1;
    Excel.ActiveChart.ChartTitle.Characters.Text = 'Temperatur';
    Excel.ActiveChart.Name = 'Temperatur';
    % Setting the (X-Axis) and (Y-Axis) titles.
    ChartAxes = invoke(Chart,'Axes',1);
    set(ChartAxes,'HasTitle',1);
    set(ChartAxes.AxisTitle,'Caption','Temperatur /°C');
    ChartAxes = invoke(Chart,'Axes',2);
    set(ChartAxes,'HasTitle',2);
    set(ChartAxes.AxisTitle,'Caption','Tiefe /m');
    Excel.ActiveChart.ChartType = 73;
    temp=[handles.T,handles.T_E,handles.Twz];
    %     Setting the (X-Axis) Scale
    Excel.ActiveChart.Axes(1).Select;
    Excel.ActiveChart.Axes(1).MinimumScale = min(temp(:));
    Excel.ActiveChart.Axes(1).MaximumScale = max(temp(:));
    %     Setting the (Y-Axis) Scale
    Excel.ActiveChart.Axes(2).Select;
    Excel.ActiveChart.Axes(2).MinimumScale = 0;            
    Excel.ActiveChart.Axes(2).MaximumScale = max(handles.tiefe(:,C));
    Excel.ActiveChart.Axes(2).ReversePlotOrder = true;
    WB.Save();
    WB.Close;
 
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.